.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?
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?
resolve: { init: resolve: { fooBar: --
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/lU30ZFaNwJc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
Thanks. I tested the app yesterday, removed all elements from pages (partials/directives) and just navigated from page to page.The memory the app uses increases steadily until the eventually it crashes. I am trying to figure out what is not getting released.
Right?is basically meaningless, it could be:Theresolve: { init:
resolve: { fooBar:
And is creating an anonymous "literal JavaScript array that contains a string and a function. It is one way to make an injectable function save for minimizing." mean that it isn't garbage collected?
--
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 angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.