If I want to refer to my angular controller function from a template, I should put the function in $scope, like this:
[template]
<button ng-click="doSomething()"></button>
[controller]
$scope.doSomething = function(){};
But what about other functions (and controller variables that I don't need to be watched), the ones that I will not reference in templates.
Should I put them all in '$scope' too?
Isn't it bad for performance?
Is there any gotchas in declaring such functions outside of $scope?
this.myFunction=..orvar myFunction=...?function myFunction() {... }. The problem withvar myFunction=...is that it can be called only after where it is declared.this.myFunctionwill be part of scope.