#home work - variant 1
angularJs patterns
-
MVC (or MVVM with 2-way bindings)
Controller in angularJs is a instance for any controller function. controller
View is a html template which will be rendered. view
Model can be whatever (JSON objects, scope properties)
-
2-way bindings
two way data binding is presented by {{ expression }} directives: ng-model, ng-bind, ng-repeat, ng-if...
-
Pub/Sub
Pub/Sub is presented by $scope.$on, $scope.$emit, $scope.$broadcast methods
-
Singleton
All angularJs services are singletons (factory, provider, 'service') for example, service will be cached in Instance Cache after first instantiation by $injector
-
Factory
$provider can be used as a factory in angularJs for example, factory
-
Decorator
Decorators are presented by decorator method of $provide for example, decorator
-
Callbacks
Callback pattern is used very widely in angularJs, for example in animate runner