One of the nice things about jQuery is that I can write a function and access it from anywhere within my application. AngularJS appears to be different and it is kind of frustrating. For example, I have the following code on my site:
<div id="myCtrl" ng-controller="myCtrl">
<div ng-click="doSomething()">click here</div>
</div>
The problem is that doSomething()
is defined in a different controller and therefore it doesn't work. This is a common problem that I have run in to and this aspect of AngularJS makes my app more complex than just using pure jQuery to define my functions. How can I call doSomething()
from within any controller without having to create a service/factory, etc.? It just seems like that makes everything unnecessarily complicated.