Guide: Services

Improve this DocServices

Angular services are substitutable objects that are wired together using dependency injection (DI)- You can use services to organize and share code across your app-

Angular services are:

  • Lazily instantiated – Angular only instantiates a service when an application component depends on it-
  • Singletons – Each component dependent on a service gets a reference to the single instance generated by the service factory-

Angular offers several useful services (like $http), but for most applications you'll also want to 登录查看完整内容