2
我試圖只有當uid
在JSON陣列存在顯示元素:顯示元素只有在JSON數組值匹配
到目前爲止,我已經嘗試過:
var app = agular.module('myApp', []);
app.controller('myCtrl', function() {
$scope.uid = '10';
$scope.datas = [{
'id': '1',
'name': 'abc'
}, {
'id': '2',
'name': 'xyz'
}];
});
<p ng-if="datas.length | filter:{id: uid}">ID exist in array</p>
是不是可以在VIEW? – Jay
更新了答案,只包括查看解決方案 – marcinn
我試過但沒有工作。如果你可以更新我的小提琴並給我一個生動的例子。 – Jay