2
如何列出下拉選項從下面的JSON對象,其中IsDeleted == 0
角JS過濾器下拉選項
"currencies":[{
"CurrencyID":"1",
"CurrencyCode":"AED",
"CurrencyName":"United Arab Emirates Dirham",
"IsDeleted":"1"
},{
"CurrencyID":"2",
"CurrencyCode":"AFN",
"CurrencyName":"Afghan Afghani",
"IsDeleted":"1"
},{
"CurrencyID":"3",
"CurrencyCode":"ALL",
"CurrencyName":"Albanian Lek",
"IsDeleted":"1"
}];
<select ng-model="data.CurrencyID" ng-options="cu.CurrencyID as cu.CurrencyName for cu in currencies | filter : IsDeleted :'0'"></select>
實際上的問題是與分配給作爲貨幣$默認值scope.currencies = {};拋出錯誤和過濾器停止工作..每當在json數組上使用過濾器時,默認值不應該是$ scope.currencies = {}; – user2866086