VideosMy ProjectsProgramming BlogGallery
  1. Home
  2. Blog
  3. The difference between services and providers in AngularJS
Programming Blog

Atom/RSS Feed

angular/angularjs

The difference between services and providers in AngularJS

angular/angularjs

An easy way to remember it is that Providers are at config time (before the application has finished loading).

Services are while the application is running.

Example Service and Provider init

angular.module('moduleName', [])
       .config((injectables) => { // provider & constants
           // do configuration
       })
       .run((injectables) => { // services & constants
           // do initialization
       });
Join my mailing list