Answer the question
In order to leave comments, you need to log in
How to load data with possibly different types into the controller?
Angular used to support the ability to load data directly from a Promise. For logical reasons (not obvious assignment), this feature was removed.
Now you need to write like this
getdata(1).then(function(data)
{
$scope.data = data;
});
Интерфейс
loadData($scope, name, getter, params);
//и вызов
loadData($scope, 'data',getdata, [1]);
Answer the question
In order to leave comments, you need to log in
$q.when
$q.when(loadData()).then(function (result) {
$scope.data = result;
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question