Service in Angular

September 12, 2018

What is angular service?

This is a function or object which can be shared in your Application. Services use the dependency injection mechanism. This is a singleton object

Angular service is a stateless object

You can create your own service in Angular. There are in build service in Angular

Why do you need service?

You can use services to organize and share code across the application. Angular service is singleton object which means you instantiate the object only once during life cycle of the application

How to create service

ng g service product

This will generate two files at