Thank you so much for your assistance! Disclaimer - I am a newcomer to Angular and coding in general. So I tried your suggestion. I setup an isolate scope and passed in the user object. But, the controller still can't read the object due to a new vm scope in it. Further, the friend value being passed from ng-repeat also becomes undefined due to isolate scope. So I passed in friend as well and same undefined due to the new vm scope. Any other tips?
I am trying to use the vm object and not $scope as available in Angular 1.3. Also, I am a little confused with both bindToController and ControllerAs in directive properties and didnt find good tutorials for these online. cheers Amit On Sunday, February 21, 2016 at 2:03:07 AM UTC-8, Sander Elias wrote: > > Hi Amit, > > One of your first lines in your controller is: `var vm = this;` right. So > here you are defining `vm` as a local variable. > A few lines later you do this: `vm.user.friends.indexOf(friend)`. You > never defined user in the controller, so this will never work. > > Where does that come from? it's not defined anywhere in your controller. > What you need to do is add an binding to your removeFriend directive, so > it can access all data it needs. Go ahead and try, if you don't get it > going, just ask, and I will help you along. > > Regards > Sander > > > > -- 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 https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
