我有以下代码:
$scope.listaOcorrencias = TesteServico.getListaOcorrencia();
//This generate $scope.listaOcorrencias.list with data
//but if i try to read the $scope.listaOcorrencias.list give error
console.log($scope.listaOcorrencias.list); //returns undefined
$scope.listaOcorrencia = $scope.listaOcorrencias.list; //undefined too
真的不知道该怎么做。
console.log($scope.listaOcorrencias)
返回:
Resource {$promise: Object, $resolved: false, $get: function, $save: function, $query: function…}
$promise: Object
$resolved: true
list: Array[1]
__proto__: Resource
TesteServico.getListaOcorrencia():
return $resource('http://127.0.0.1:8080/teste/:classe/:action', {}, {
getListaOcorrencia: { method: 'GET', params:{classe: 'Ocorrencia', action: 'listaDeAssuntos'}, headers : { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' }
}