Notizen
Architecture and general layout
Inhalt der Notizen (1)
Seite 1
Controllers, directives and unit testing Should I put methods in the directive or the controller?
Thinking through how you're going to unit test things will force you to think carefully about whether to put a method in a directive or the controller.
In general, methods related to business logic, navigation, etc. should be in the controller (and the directive can inherit them)
A directive is concerned with the view / DOM. If you're testing a method in a directive you should be testing it's changes to the DOM.
Informationen
- Beschreibung
- A-Level Angular Notiz am Architecture and general layout, erstellt von James Drummond am 04/05/2015.
- Erstellt von
- James Drummond · Mai 2015
- Aktualisiert
- 19 Feb 2016
- Aufrufe
- 22
- Tags
- Bewertung