9
请看详细信息。为什么输出错误?角JS过滤器等于
HTML:
<div ng-app>
<div ng-controller="TodoCtrl">
<h1>List</h1>
<div ng-repeat="t in todos | filter:{ id: '-1'}">{{t.text}}</div>
</div>
</div>
角码:
function TodoCtrl($scope) {
$scope.todos = [{
text: 'learn angular',
done: true,
id: -1
},{
text: 'learn angular 2',
done: true,
id: -11
}, {
text: 'build an angular app',
done: false,
id: 1
}];
}
输出:
learn angular
learn angular 2
请参阅:
过滤器:{ID: '-1'}
为何输出包括:
learn angular 2
我想搜索的ID -1
,但learn angular 2
是-11
为什么会出现这种情况? – Flezcano
如果我想要不等于-1值,那么:true? –
你可以帮助这个'http:// jsfiddle.net/U3pVM/33383 /',为什么最后一个不显示在输出中,事件有id是-12? –