javascript - how to hide list when user select item from list? -
could please tell me how hide list when user select item list .actually when user type on text field show list , when user select row list set value on text field .but time need hide list .so take 1 boolean variable $scope.islisthide=false; using value need hide or show list .please press "a" select value list .i use ng-show how add condition in .
<div class="listcontainer" ng-show="search.stationcode" > <li ng-click="rowclick(station)" class="item" ng-repeat="station in data.data | filter:search.stationcode :startswith">{{station.stationname+"-("+station.stationcode+")"}}</li> </div> $scope.rowclick = function(station) { $scope.search.stationcode=station.stationcode; // $scope.$apply(); }
here code http://codepen.io/anon/pen/zgypwj
just use flag indicate whether selection has been made. here's example:
http://codepen.io/anon/pen/rpwjvn
i using flag called selected