Skip to main content

Posts

Showing posts with the label What are the features of Angular 2 Service?

What is Angular 2 Service? [Steps For Create and Use of Angular 2 Services]

What is an Angular 2 Service? Angular 2 service is a class that encapsulates some methods (GET/POST/PUT) and provides it result as a service for across your application. What are the features of Angular 2 Service? The Angular 2 is using services concept and it provide the multiple features to us that are, 1.       Services are singleton objects. 2.       Services are capable of returning the data in the form promises or observables. 3.       Service class is decorated with Injectable decorator. 4.       The Injectable decorator is required only if our service class is making use of some Angular injectable like Http, Response and HttpModule service within it. What are the differences between Observables & Promises? 1.       Promise :-  Promises are only called once and It  can return only a single value at a time and the Promis...