当前位置 : 主页 > 网络编程 > JavaScript >

json过滤(angularjs)

来源:互联网 收集:自由互联 发布时间:2021-06-28
angular.forEach $scope.defaultDivisionMapping = [{ "id": 10045, "lookupType": "DIVISION_MAPPING", "meaning": "采购订单取消一览表" },{ "id": 10046, "lookupType": "DIVISION_MAPPING", "meaning": "采购订单一览表" }];$scope.defau
angular.forEach
$scope.defaultDivisionMapping = [{
        "id": 10045,
        "lookupType": "DIVISION_MAPPING",
        "meaning": "采购订单取消一览表"
    },{
        "id": 10046,
        "lookupType": "DIVISION_MAPPING",
        "meaning": "采购订单一览表"
    }
];
	$scope.defaultMapping = filterTextMapping($scope.defaultDivisionMapping)
	function filterTextMapping(defaultDivisionMapping) {
        var defaultMapping = {};
        angular.forEach(defaultDivisionMapping, function (value, key) {
            defaultMapping[value.lookupCode] = value.meaning;
        });
		return defaultMapping;
    };
网友评论