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.

The resolve: { init:
is basically meaningless, it could be:
resolve: { fooBar:

Right?

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?


On Mon, Aug 18, 2014 at 4:09 PM, Mark Volkmann <r.mark.volkm...@gmail.com>
wrote:

> On Mon, Aug 18, 2014 at 2:53 PM, Jonathan Matthew Beck <dnc....@gmail.com>
> wrote:
>
>> 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?
>>
> It is defining a route. The resolve part basically says "Don't render this
> route until all this data is available." The most common thing that resolve
> functions do is retrieve data from REST services. Maybe dataService.init
> does that. If the functions in a resolve return promises, Angular waits for
> all of those be resolved before it renders the view for that route.
>
>> 2) Does it create a new instance of an un-named something (service?)
>> every time the user is routed?
>>
> It creates a new instance of HomeController every time the user goes to
> that route.
>
>> 3) The square brackets are confusing me, are we over-writing the
>> Controller’s init() function every time?
>>
>
> The square brackets are just creating a literal JavaScript array that
> contains a string and a function. It is one way to make an injectable
> function save for minimizing. That won't mean much if you are just getting
> started with AngularJS, but later it will make sense.
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to angular@googlegroups.com.
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to