I created a helper service to wrap the $http.get.
self.apiGet = function (url, success, failure, always) {
$http.get(url)
.then(function (result) {
success(result);
if (always != null)
always();
}, function (result) {
if (failure != null) {
failure(result);
}
else {
}
if (always != null)
always();
});
}
In my controller class, the data is not returned to the view when calling getData(val). the data is returned from the api when I debug it.
$scope.getData = function (val) {
return helper.apiGet(url,
function (result) {
return result.data;
});
};
corsenabled in the other app (the api)?csrfandcorsare different but I guess you know that already.