controller) • Providers are injected into controller at runtime • Once defined you can inject into controller, controllers or factory. • A provider can rely on another provider • Types of providers - constant, value, factory, service, decorator, provider • Difference is the way it creates objects and which gets the data
injectable anywhere! app.constant('jellyBean', 4.2); • VALUE - A simple injectable value. [can not be injected into config] app.value('name', 'Larry'); • SERVICE - Injectable constructor. app.service('api', function (dep) {...}); • FACTORY - Injectable function for returning factory stuff. app.factory('widget', function (dep) {... return ?;}) • DECORATOR - Modify or encapsulate other provisions. $provide.decorate('name', function($delegate) { return $delegate + ' the Great’; }); • Providers - You just need a $get method. $provide.provider('foo', {$get: function(dep) {...}}); $provide.provider('foo', function(){ this.$get = function(dep) {...} }); It’s a overkill! but it’s the core verbose.
Directives - Extend HTML with custom attributes and elements • Model - The data shown to the user in the view and with which the user interacts • Scope - Context where the model is stored so that controllers, directives and expressions can access it • Expressions - Access variables and functions from the scope • Filter - Formats the value of an expression for display to the user • View - What the user sees (the DOM) • Data Binding - Sync data between the model and the view • Controller - The business logic behind views • Dependency Injection - Creates and wires objects and functions • Module - A container for the different parts of an app including controllers, services, filters, directives • Service/Provider - Reusable business logic independent of views