AngularJS Notes

Managing data via scopes is reckless. Scopes can easily become corrupted or dirtied by other controllers, directives, models and the like. It gets messy quickly (use services).

Controllers should be used purely to wire up services, dependencies and other objects, and assign them to the view via scope.

A common anti-pattern (in my humble opinion) is adding DOM interactions to the controller. Angular defines directives as chunks of code you use for DOM manipulation, but I feel it’s also great for interactions.

[i]

Leave a Reply

Your email address will not be published. Required fields are marked *