I realise this may just a regular javascript/asynchronous programming query, but AngularJS is where i'd most like to see a reduction in boilerplate for common tasks.
I commonly have these types of patterns in AngularJS controller, where the actual loading and storing of data is delegated to a Service.
$scope.user = null;
$scope.init = function(){
// load user
profileService.loadUser(function(user){
$scope.apply(function(){
$scope.user = user;
});
});
};
It's quite a verbose 'getter'. Is there a better pattern to get data into the scope from a service?