So, the .push calls in the fiddle were just a replacement for an $http call in
my code. Now that the controllerAs bit is working, I'm seeing a timing issue
in my code. I can see the http call returning the array I expect, but it isn't
making it into the template. Here's the replacement code for the to push lines:
$http.get('index.cfm?action=api.getCustomers')
.success(function(customers) {$log.log(customers);
this.customers = customers})
.error();
$log.log("last log");
$log.log(this.customers);
I'm seeing the $log.log(customers) from the http call show in console AFTER I
see the 'last log' and the empty this.customers array.
Am I missing something about the compile timing? I still don't fully
understand the best way to handle this.
Thanks again for the help.
On Aug 28, 2014, at 3:39 AM, Sander Elias <[email protected]> wrote:
>
> The this var in the template is never a controller. It's in most cases the
> current scope, but don't depend/use it that way!
> easiest way, use controllerAs, as shown in your adapted fiddle:
> http://jsfiddle.net/dyL6gLze/
>
> Regards
> Sander
>
> --
> 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/0VtRjYNl9vw/unsubscribe.
> To unsubscribe from this group and all its topics, 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.
--
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.