Hi Dave,

Just as I typed up in my previous message. Don't use ngController in your 
templates.  
How?, it's not too difficult to replace them with small 'component' 
directives. I took an existing sample, and updated it 
<http://plnkr.co/edit/Ep3lyU0ZpnOvNtitBM2z?p=preview>a bit to show you how 
it can be done. There are more and better way's to do this. But I think 
this is a good first step, that's easy to comprehend.

The why is a bit more difficult to explain. It mainly boils down to having 
code that's easier to reason about. And it is easier to find where stuff is 
coming from. (when you are in a project, and your 4 levels of controllers 
deep, and you are looking at your template, do you know which 
controller/component is providing each variable?) This is making your 
project more robust, and easier to maintain.
Then there is the why of a ngController also. Why did you feel the need to 
put it just there in your template? What functionality is is encapsulating? 
What is the meaning of ngController itself? All of these answers become 
easier to answer when you move towards using directives.
And lastly, angular 2.x will not have ngController. So if you want to 
future-proof your code you should move away from using it. 

So, does that answer your question? If not, just ask!
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 http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to