//timeout needed because need to place loading spin animation before async call
$scope.loadProgramAreas("programAreas", function(data){
$scope.programAreas = data;
if ($scope.programAreas.length == 0) {
$scope.loadProgramAreas = function (api, callback) {
$timeout(function () {
module.changeState($scope, _log);
try {
$scope.$digest();
} catch (exception) {
frame.con.info(exception);
}
}, 0);
$timeout(function () {
frame.con.info("before getinformation:");
cfaes_info.getInformation("", true, "api/cfaes_module/" + api, "", "", function (data) {
console.log("Get program areas:data returned");
console.log(data);
if (data == null) {
$scope.state = "noData";
callback(null);
} else {
callback(data);
}
});
try {
$scope.$digest();
} catch (exception) {
frame.con.info(exception);
}
}, 1);
};
No comments:
Post a Comment