Skip to content

Commit eb3dbe4

Browse files
committed
keep controllers focused. 1 controller per view
1 parent 39f7a7e commit eb3dbe4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,10 @@ While this guide explains the *what*, *why* and *how*, I find it helpful to see
535535
}
536536
```
537537
538+
- **Keep Controllers Focused**: Define a controller for a view, and try not to reuse the controller for other views. Instead, move reusable logic to factories and keep the controller simple and focused on its view.
539+
540+
*Why?*: Reusing controllers with several views is brittle and good end to end (e2e) test coverage is required to ensure stability large applications.
541+
538542
- **Assigning Controllers**: When a controller must be paired with a view and either component may be re-used by other controllers or views, define controllers along with their routes.
539543
540544
- Note: If a View is loaded via another means besides a route, then use the `ng-controller="Avengers as vm"` syntax.

0 commit comments

Comments
 (0)