![]() The purpose of the scope is to refer to model, not to be the model. Treat scope as read-only in templates and write-only in controllers. ![]() Scope in controller should be used for binding model with view andĮncapsulating View Model as for Presentation Model design pattern. Inject models as shared services instead. In this case parent controller is interpreted as model. The emitted and broadcasted messages should be kept to a minimum.Ĭontroller should not care about presentation or DOM manipulation. It should be moved to model.Ĭontroller may communicate with other controllers using method invocation (possible when children wants to communicate with parent) or $emit, $broadcast and $on methods. It is highly recommended to avoid business logic in controller. Thanks to a huge amount of valuable sources I've got some general recommendations for implementing components in AngularJS apps: ControllerĬontroller should be just an interlayer between model and view.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |