$ scope.watchでオートコンプリートを作成しようとしていますが、完璧に機能しますが、オプションを選択してアイテムをクリックすると、入力はオンになりますが、私はそれを入力に入れたときに時計が再び活性化されるので、隠してはいけません...時計でオートコンプリートの項目を表示しない
私はその項目を非表示にする方法を知っていません。
すべてのヘルプ..
<input type="text" ng-model="selected" />
<ul class="listFavoInbox">
<li ng-repeat="favo in resultAuto" ng-click="itemFavoInbox(favo.first,favo.id)">
{{favo.first}}
</li>
</ul>
$scope.selected = "";
$scope.arrayFavo = [
{'id': 1, 'first': 'John', 'last': 'Depp', 'age':52, 'gender':'male'},
{'id': 2, 'first': 'Sally', 'last': 'JoHanson', 'age':13, 'gender':'female'},
{'id': 3, 'first': 'Taylor', 'last': 'Swift', 'age':22, 'gender':'female'},
];
$scope.$watch('selected', function() {
$scope.resultAuto = [];
for(var i=0; i<$scope.arrayFavo.length; i++){
var text = angular.lowercase($scope.arrayFavo[i].first);
var search = angular.lowercase($scope.selected);
// console.log("text array",text);
// console.log("text",$scope.selected);
if (search != ""){
if (text.indexOf(search) !== -1){
$scope.resultAuto.push($scope.arrayFavo[i]);
}
console.log($scope.resultAuto);
}
}
});
$scope.itemFavoInbox = function (name,id){
$scope.selected = name;
$scope.resultAuto = "";
}
OK、それは良いですが、私の本当の質問は、私は項目を選択したとき、私はこれは私の問題である、項目リストを隠す必要があります。 – user3810167