数组就是这样:
$ scope.domicile = {}; $ scope.domicile.users = [ {DomicileName:' European',PortFolioName:' nternational Select x EM ADR',Alias:' ADR x EM',Percentage:1.0,Ticker:' ADR',类别:' ADRxEM',SortOrder:1}, {DomicileName:' European',PortFolioName:' International Select x EM ORD',Alias:' Ord x EM',Percentage:4,Ticker:' ORD',类别:' ADRxEM',SortOrder:1}, {DomicileName:' European',PortFolioName:' International Select with EM ADR',Alias:' ADR w EM',Percentage:4,Ticker:' ADR',类别:' ADRwEM',SortOrder:'' }, {DomicileName:'开发市场非欧洲',PortFolioName:'国际选择x EM ADR',Alias:' ADR x EM',百分比:4,Ticker: ' ADR',类别:' ADRxEM',SortOrder:1} ];
enter code here
答案 0 :(得分:0)
假设您想将数据推送到$scope.fetched = []
数组,只需在代码中写下:
$scope.fetched = $scope.domicile.users.filter(function(user) {
return user.DomicileName === 'European';
});
答案 1 :(得分:0)
$scope.fetched = [];
angular.forEach($scope.domicile.users, function(value, key) {
if (value["DomicileName"] === "European") {
$scope.fetched.push($scope.domicile.users[key]); // add to array
}
})
答案 2 :(得分:0)
过滤 $ scope.domicile.users 的数据
$scope.domicile = $scope.domicile.users.filter(function(val) {
return val['DomicileName'] == 'European'
});
console.log($scope.domicile);