Separation of Responsibilities

An extremely important part of designing AngularJS applications is the separation of responsibilities. The whole reason you choose a structured framework is to ensure that code is well implemented, easy to follow, maintainable, and testable. Angular provides a very structured framework to work from, but you still need to ensure that you implement AngularJS in the appropriate manner.

The following are a few rules to follow when implementing AngularJS:

■ The view acts as the official presentation structure for the application. Indicate any presentation logic as directives in the HTML template of the view.

■ If you need to perform any DOM manipulation, do it in a built-in or your own custom directive JavaScript code—and ...

Get Learning AngularJS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.