2
다음과 같은 작업을하려고합니다. 컨트롤러에서 $ recource 호출을 사용하여 데이터베이스에서 데이터를 가져 오는 함수가 있습니다. 서비스 '는 myService'
var fillSubData = function (containerToFill) {
resService.getSubDataFromDB(//$resource service
{params},
function (res) {
//do something with containerToFill with the result res add new values
}
);
}
var fillData = function (containerToFill) {
resService.getDataFromDB(//$resource service
{params},
function (res) {
//do something with containerToFill with the result res
fillSubData(containerToFill);
}
);
}
컨트롤러
$scope.dataToFill;// object
var initialize = function() {
//by reference
myService.fillData(dataToFill);
// I need the dataToFill filled to do other thing with data recovered and built
angular.forEach(dataToFill.someArrayBuilt, function (item) {
//do something with item...
})
}
I 복구 및 내장 데이터를 다른 일을 가득 dataToFill 필요하지만 자원 호출 asyn이다, 나는이 작업을 수행 할 수있는 방법?