角度アプリでは、検索フィールドに対して私はコントローラのフィルタ機能を使用しています。それはうまく動作しますが、私は現在のモデルでng-blur
を実装することができません。`ng-blur` - ドロップダウンボックスで期待どおりに動揺しない
なぜこれが動作しないのか分かりませんが、いずれにしても助けてくれますか?
だけでなく、私は(クライアントの要求ごとのような)2つの別々の行にデータを表示しています、いずれかのより良い方法を知っていれば、私はぼかしを使用するときに私は
を知らせ、同様に私の表示アプローチを評価してください、選択したリストの何のクリック時に:ここ
<div class="child">
<input type="text" ng-model="search"
ng-focus="isDropDown = true"
ng-blur="isDropDown = false" //nothing selected if blur exist
ng-keyup="village='';isDropDown = true"
>
私のコードは次のとおりです。
HTML:
<div class="parent" >
<div class="child">
<input type="text" ng-model="search"
ng-focus="isDropDown = true"
ng-keyup="village='';isDropDown = true"
>
<span>{{village | uppercase }}</span>
</div>
<table ng-show="isDropDown" ng-mouseleave="isDropDown = false">
<tbody>
<tr ng-repeat="item in items" ng-click="select(item);">
<td>{{item.id}}</td>
<td>{{item.name}}</td>
</tr>
</tbody>
</table>
</div>
のJS一部:
$scope.items2 = $scope.items;
$scope.isDropDown = false;
$scope.$watch('search', function(val) {
$scope.items = $filter('filter')($scope.items2, val);
});
$scope.select = function(item) {
$scope.isDropDown=false; // how to put this in inline? (html)
$scope.search = item.name;
$scope.village = item.village;
}
は、あなたの条件 –