2016-09-23 4 views
0

개체의 배열에서 ID를 얻으려고하고 있지만 $scope.data.id은 배열 개체에서 데이터를 가져 오는 데있어 잘못된 또는 더 나은 anglejs 방법이 무엇인지 구현되지 않았습니까?angularjs를 사용하여 객체의 배열에서 id를 얻는 방법은 무엇입니까?

데이터

[{"_id":"57e540ab352e81329c984aba","name":"test diagram","owner":"wp6307","diagram":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<definitions xmlns=\"http://www.omg.org/spec/BPMN/20100524/MODEL\"\r\n"}] 

ctrl.js

diagramService.getDiagrams() 
     .then(function (resp) { 
      $scope.data = resp.data; 
      console.log(JSON.stringify($scope.data)); 
      console.log($scope.data[0]._id); } 
+0

의 $ scope.data [0] [ "_ id"] 여야합니까? –

답변

0

Plz은 $ scope.data 시도 [0] [ "_ ID 「대신 $ scope.data [0] ._ ID

관련 문제