Skip to main content

Posts

Showing posts from May, 2014

AngularJS: dummy guide for service, factory, provider, configuration

Resources: Angular.js: service vs provider vs factory? AngularJS Factory, Service and Provider Understanding Service Types Angular Constants, Values, Factories, Services, Providers and Decorators, Oh My! Providers (docs) $provide (docs) Summary of below explanation After writing below explanation I found out that I just need very short summary for each time I write service or factory. General Idea Service / Factory / Provider are ways to define singletons in angularJS application. they are injected when asked for. When they are defined, they are given (1) name and (2) function. Service and Factory are suger function that convert their input to providers. Usage: Value injected for service - instance of the service function. Value injected for factory - return value of factory function. Value injected for provider -  In config phase - instance of provider function. In run phase - return value of $get() of provider function. Overview All Services