1
我正在做角表過濾器。我的first attempt是試圖將其包括在標題上。該圖標顯示在錯誤的位置,當我將文本框的焦點更改爲排序時。將角度更新一個`ng模型`裏面<tfoot>
所以我把箱子移動到<tfoot>
,但它看起來好像被禁用了,因爲即使當我改變文本框上的內容ng-model="filter_id"
它也不會改變。
外部文本框,完美的作品。
在圖片:
- 按1上
<tfoot input text>
:文本框變更爲1,事件觸發updateFilteredList
但filter_id
是空的,既不<p input text>
也不{{filter_id}}
變化。在<p input text>
文本框更改爲11,同樣的行爲 - 按1:
- 再次按1上
<tfoot input text>
文本框更改爲1,{{filter_id}}
更新1
和updateFilteredList
也得到filter_id=1
(甚至當過濾器1點返回相同的列表);
編輯
我發現,當應用程序開始,如果我在外部文本框中INTERAL得到更新類型。但是當我在內部鍵入一個字符時,請停止更新。
<div ng-controller="eventCtrl">
<table class="table table-striped" at-table at-list="filteredList"
at-config="config" at-paginated>
<thead></thead>
<tfoot>
<tr>
<th><input type="text" ng-change="updateFilteredList()"
ng-model="filter_id" style="width: 50px" />
</th>
</tr>
</tfoot>
<tbody></tbody>
</table>
<at-pagination at-config="config" at-list="filteredList"></at-pagination>
<p>
<input type="text" ng-change="updateFilteredList()"
ng-model="filter_id" />
{{filter_id}}
</p>
</div>
我使用這個plug-in我的表。這是一個錯誤還是可能是插件的一些行爲?有沒有辦法檢測插件是否覆蓋了一些事件?
控制器:
app5.controller('eventCtrl', ["$scope", "$filter", "$http" , function ($scope, $filter, $http) {
$scope.cars = [
{ Car_ID: 1, X: null, Y: null, RoadName: null, Azimuth: null, DateTime: null, Adress: null }
];
$scope.filteredList = $scope.cars;
$scope.filter_id = "";
$scope.updateFilteredList = function() {
console.log('filter_id: ' + $scope.filter_id);
$scope.filteredList = $filter("filter")($scope.cars, $scope.filter_id);
console.log('filteredList.length:' + $scope.filteredList.length);
};
您也可以使用[**角的jqLite **](HTTPS: //docs.angularjs.org/api/ng/function/angular.element)。 – developer033