html - ng-show through controller is not working -
i have page 3 elements. first search bar, second search result area , third form. here use case like, default search bar , form div showing , hiding search result div. if enter keys on search bar client data , want hide form bar , show search bar result. in search var result if click 1 of item(client) hide search result , show form div. , want fill clicked client name in form field, new in angularjs please me out.
<ion-view title="client details" id="page5" ng-init="issearch=false;isform=true;" style="background-color:#f1f8e9;"> <ion-content padding="true" class="has-header"> <label class="item item-input"> <i class="icon ion-search placeholder-icon"></i> <input type="search" ng-model="str" ng-change="searchbyname(str)" placeholder="search client"> </label> <ion-list ng-show="{{issearch}}" id="home-list2"> <ion-item ng-repeat="client in clientlist" id="home-list-item2" ng-click="str=true">{{client.name}}</ion-item> </ion-list> <form ng-show="{{isform}}" id="clientdetails-form1" class="list "> <label class="item item-input item-floating-label" id="clientdetails-input1"> <span class="input-label">name</span> <input type="text" placeholder="name"> </label> </form> </ion-content>
and controller file
(function() { var app = angular.module('clientdetailsctrl', ['clientdetailsservice']); app.run(function($rootscope, $state, clientdetails) { }); app.controller('clientdetailsctrl', function($scope, $rootscope, $state, clientdetails) { $scope.searchbyname = function(str) { $scope.issearch = true; $scope.isform = false; $scope.clientlist = []; clientdetails.searchbyname($scope, str); }; });})();
here trying change values of issearch , isform values, no luck.
change:
ng-show="{{isform}}"
to
ng-show="isform"
you dont have force evaluation of ng-show
Comments
Post a Comment