Posts

Showing posts with the label Angular HTTP Client

Angular Configuration

Image
In Previous topic we have seen about Angular Observable , in this topic we will look into configuration part of our angular application.  When an application starts it need some sort of runtime configuration information like UR endpoint etc.   APP_INITIALIZER ➤➤➤ APP_INITIALIZER is a dependency injection token that you can use to provide one or more initialization functions. The provided functions are injected at application startup and executed during app initialization. If any of these function returns a Promise or Observable, initialization does not complete until the promise is resolved or Observable is completed.  We will look into an example in which we will get some results, these results usually returned as an observable or a promise which matches exactly with the signature of APP_INITIALIZER function. So to use this service we do not need to create any new instance like Service service = new Service(); Angular will handle these through dependency injection, we ...

Angular HTTP Client

Image
In Previous topic we look into Service & Dependency Injection  in Angular. In this topic we will look into Angular HTTP Client. Before looking into the HTTP clients you have to create one angular application. You can refer below URL's for installing for installing Nodes, visual Studio, Angular CLI and create Angular Application. Install NodeJs & Visual Studio Install Angular CLI Create Angular Application HTTP Client ➤➤ HTTP Client is a built in Service available in  from '@angular/common/http'  package. It uses the RxJS Observable based API's which means it returns the observable and what we need to subscribe it. RxJS Observable ➤➤ An Observable is an object that helps to manage async code. So to use it we need observable library called RxJS(Reactive Extension for JavaScript). RxJS is a library for reactive programming using observables that makes it easier to compose async code. Angular uses observables as interface to handle the common asynchronous operatio...