thanks Pete, but I remember that before I use "this", and then I was told
to move to "$scope", since some say that $scope is the view model that
combines your template and controller. Seems that suggestion is not a valid
one.
But when I use "this.user={}", is the user stored in the controller or
stored in the $scope internally?On Mon, Jun 22, 2015 at 4:36 PM, Pete Bacon Darwin <[email protected]> wrote: > The Angular team are encouraging less use of the $scope object inside > controllers and leaning towards the `controller as` style, where you use > `this.user...`, since this makes you controllers even less reliant upon > Angular implementation details (i.e. scope) and is also more aligned with > how "component" directives are defined in Angualr 2. > > On 22 June 2015 at 07:32, bargitta <[email protected]> wrote: > >> Hi, >> >> Do you use $scope in your controller to setup variables that will be used >> in the html template? >> Or do you use this like this.user = {} in your UserController and ctrl as >> UserController, ctrl.user in the html template? >> What is the recommended way? >> >> -- >> 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. >> > > -- > 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/JW5hgkCWRlQ/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.
