标签集prevents表更新 [英] tabset prevents table update
问题描述
我有一个过滤器的工作表:
http://plnkr.co/edit/WnV7OUplcLHVOKbeTrSw?p=$p$pview一>
I have a working table with a filter: http://plnkr.co/edit/WnV7OUplcLHVOKbeTrSw?p=preview
在它停止工作(过滤器仍然是更新)一个标签集包装它后:
http://plnkr.co/edit/8uw2UhSC59txms5X563L?p=$p$pview一>
After wrapping it in a tabset it stops working (the filter is still updated): http://plnkr.co/edit/8uw2UhSC59txms5X563L?p=preview
但它与旧版本的工作我更新前:
http://plnkr.co/edit/eJvYtpc3efkydsQy8caL?p=$p$pview一>
But it worked with old versions before I updated: http://plnkr.co/edit/eJvYtpc3efkydsQy8caL?p=preview
(角1.0.8 + 2.0.3自举角+的用户界面,引导-0.6.0)
(angular 1.0.8 + bootstrap 2.0.3 + angular-ui-bootstrap-0.6.0)
为什么停止了更新后的工作?
Why did it stop working after the update?
推荐答案
http://plnkr.co/edit/ 70sLuA4gltgxhwTE0XT1
HTML(刚刚修改过滤网使用)
HTML (Just modified the filter usage)
<!doctype html>
<html ng-app="plunker">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.8/angular.js"></script>
<script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.10.0.js"></script>
<script src="example.js"></script>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div ng-controller="TabsDemoCtrl">
<tabset>
<tab heading="broken filter">
<form class="form-inline" role="form">
<select id="okFilterbox" ng-model="okFilterBool">
<option>nothing</option>
<option>all</option>
</select>
</form>
<p>{{okFilterBool}}</p>
<div>
<table>
<tr ng-repeat="item in items | filterItem:okFilterBool">
<td>{{item.name}}</td>
</tr>
</table>
</div>
</tab>
<tab heading="tab2">
</tab>
</div>
</body>
</html>
JS(改变了过滤器定义,以一个新的'角'过滤器的方式)
JS (Changed the way the filter is defined to make a new 'Angular' filter)
angular.module('plunker', ['ui.bootstrap']);
var TabsDemoCtrl = function ($scope) {
$scope.okFilterBool = "all";
$scope.items = [
{ name: 'A'},
{ name: 'B'},
{ name: 'C'}
];
};
angular.module("plunker").filter("filterItem", function(){
return function(array, okFilterBool){
if(okFilterBool == "all"){ return array; }
return [];
}
})
这篇关于标签集prevents表更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!