2017-11-16 8 views
-2

に基づいて複数のJSONをパースする私はこのどのようにそのインデックス

$scope.asd = angular.fromJson($scope.asd[0].jfk); 

ようなスクリプトを持っていますが、それだけで唯一のインデックス0でオブジェクトを解析し、私はインデックスで唯一のインデックスに基づいて、すべてのオブジェクトを解析します0。 angularjsでそれを行う方法を

私pseucode

var i = get index; 
for(k=0;k<i){ 
$scope.asd = angular.fromJson($scope.asd[0].jfk); 
} 

+1

を行うことができます!いくつかの例を与えることで好きです。 – vibhor1997a

+1

しないでください。 '$ scope.asd = angular.fromJson($ scope.asd)'のすべてを解析し、次に_that_オブジェクトを反復処理します。 – msanford

答えて

0

あなたの問題についてより明確に詳しく説明してくださいあなたは

var arr=angular.fromJson($scope.asd); 
$scope.abc=arr.map(function(x){ 
    return x.jfk; 
}); 
//Now You can access all the jfk properties in $scope.abc like 
console.log($scope.abc[i]);//i is the index 

ような何かを行うこともできますし、単に

$scope.asd=angular.fromJson($scope.asd); 
//And access properties like 
console.log($scope.asd[i].jfk); //i is the index 
関連する問題