Hi Danny,

>
>    - 'vm' => $ctrl ✔
>
> This seems indeed to be the case, and it's more in line with ng2. However, 
personally I have a serious  issue with this. Observables are finding it's 
way into our stuff, and it seems a best practice to  use a '$' prefix to 
denote something is one. This leads to overuse of the $ character. In turn 
this will lead to hard to read code, and reason about code. $ is also being 
used in NG1 to denote angular internals. And now another use for the $? I 
don't like it at all. A controller is not an angular internal. Nor is it an 
observable.Time has to learn if this will survive. For me, I hope not ;)

>
>    - constructor => #$onInit() ✔
>
> No, in ng1, the controller itself is 'constructed' way before the $onInit, 
$onInit will get called, once all required controllers are 'newed' up. It 
is a replacement for the post/pre-link concepts. 
 

>
>    - var self = this (or that, _this ... whatever convention)
>
> This will stay with us as long as we are using JS ;). I do like the vm 
convention, but if my controller is also going to be used in the template, 
I prefer to use the tagname of the directive. Switching attention between 
template and controller becomes more explicit and easier this way. 
 

> Specifically re: *$onInit()*, am wondering if it is advisable to use 
> _all_ the time for consistency's sake or what rules of thumb the community 
> is latching on to. 
>
No, as I explained above, it's a different concept as a constructor. 
 
Oh, something else that got my attention is your use of angular.extend. 
There is no technical problem(neither a need..) to use it in the context of 
this sample. It does not add anything here. This use makes only sense if 
you retrieve an object with data from a service. However, there is an 
hidden danger in doing something like this. It is fine if you do it during 
construction, as the first thing. But in practice, data usually comes in 
afterwards, and/or repeatedly. In this case, imagine someone adding a 
property setFocus to that object? Good luck debugging that one ;)

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.

Reply via email to