I came into a project and found things like this in the routing:
.when('/home', {
templateUrl: 'partials/home.html',
controller: 'HomeController as vm',
resolve: {
init: ['dataService', function (dataService) {
return dataService.init();
}]
}
})
I looked for documentation on the use of resolve like that. As far as I
can tell, it's creating an object and then passing, or overriding, the
objects init function. Then it's creating an un-named Angular service (?)
and passing in the dataService.
Questions:
1) What is the above code doing?
2) Does it create a new instance of an un-named something (service?) every
time the user is routed?
3) The square brackets are confusing me, are we over-writing the
Controller’s init() function every time?
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.