parse.com 컬렉션에 저장된 데이터를 가져 오려고합니다. 나는 다음과 같은 비동기 서비스를 호출하는 구문 분석 자바 스크립트 SDK를 사용하고 있습니다 : parse.com에서 데이터를 가져 와서 AngularJs를 사용하여 테이블에 렌더링하는 방법
ctrl.factory('TLDs', function($q){
var query = new Parse.Query(Fahras)// Fahras is the Parse Object initialized earlier in code
query.equalTo("type", "Domain")
var myCollection = query.collection()
return {
fetchDomains: function(){
var defer = $q.defer();
myCollection.fetch({
success : function(results) {
defer.resolve(results.modles);
console.info(results.models)
},
error : function(aError) {
defer.reject(aError);
}
});
console.info(defer.promise)
return defer.promise;
}
}
}) // end of factory topDomains
내가 가져온 데이터
<div id="showdomainshere"> {{domains}}</div>
<table id="domains_table" class="table table-hover">
<thead>
<tr>
<th>Domain</th>
<th>Code</th>
<th>Subjects</th>
<th>Instances</th>
</tr>
</thead>
<tbody id="table_body">
<form id="edit_row" class="form-inline">
<tr ng-repeat="item in domains">
<td><span>{{item.attributes.arTitle}}</span>
</td>
<td><span>{{item.attributes.domainCode}}</span>
</td>
<td><span>{{subclasses}}</span>
</td>
<td><span>{{instances}}</span>
</td>
</tr>
</form>
</tbody>
</table>
</div> <!-- end of main div -->
그리고 컨트롤러, 이하에 내가보기를 렌더링하는 데 사용하는 엄마를 표시하는 간단한 테이블이 있습니다 :
ctrl.controller('Home', ['$scope','TLDs',function($scope, TLDs) {
$scope.domains = TLDs.fetchDomains()
}])
console.info를 사용하면 결과를 가져오고 예상대로 반환 된 모델 배열을 검토 할 수 있습니다. 문제는 $ scope.domains가 결코 업데이트되지 않아 결과적으로 테이블이 렌더링되지 않는다는 것입니다.
다행히 내가 다른 답변으로 대체 솔루션에 관심이있을 것인가 –