Category: Angular
Angular related post goes here.
setValue() And patchValue() In Angular 2
From angular two with reactive form its very easy to update the form controls value via these two method. Both perform the same operation of setting the value of form control. Updating Form controls from a model is very easy and flexible in Reactive Form API of Angular v2. So, setValue() and patchValue() are the… Continue reading setValue() And patchValue() In Angular 2
Incremental DOM with IVY in Angular
Incremental DOM is used internally at Google, and it is defined by this key idea: Every component gets compiled into a series of instructions. These instructions create DOM trees and update them in-place when the data changes. For instance, the following component: Will be compiled into: The template function contains the instructions rendering and updating… Continue reading Incremental DOM with IVY in Angular
What is Injectable decorator?
Injectable decorator (@Injectable) marks a class as available to Injector for creation. The service itself is a class that the CLI generated and that’s decorated with @Injectable(). What exactly does providedIn do? Determines which injectors will provide the injectable, by either associating it with an @NgModule or other InjectorType, or by specifying that this injectable… Continue reading What is Injectable decorator?
Singleton service in Angular
There are two ways to make a service a singleton in Angular: Set the providedIn property of the @Injectable() to “root”. Include the service in the AppModule or in a module that is only imported by the AppModule
@Decorators available in Angular
@Decorators are a design pattern that is used to separate modification or decoration of a class without modifying the original source code. Here is a list of @Decorators available in Angular. @NgModule @Component @Injectable @Directive @Pipe @Input @Output @HostBinding @HostListener @ContentChild @ContentChildren @ViewChild @ViewChildren @NgModule:@NgModule decorator is very common in angular. It can be seen… Continue reading @Decorators available in Angular
Angular route using query params
We can add query params in url simply by following simple rule. With typescript we can do the same as below.
Angular route using route params
We can use route feature of angular to move from one component to another. The template way of using the route feature is as below. We can route from `.ts` file using router navigate. In order to route from ts file you need to import Router from `@angular/router` and to make it available in our… Continue reading Angular route using route params
How to modify the response to an HTTP request and access it before return it out from Observable?
We often need to modify the response that is return from the http request before it return as observable. That means before we parse it into our component we might need to update. It all depends on the version of RxJs. Angular 6 launches with RxJs 6 – which means that the map()/catch() approach is… Continue reading How to modify the response to an HTTP request and access it before return it out from Observable?
Update Angular locally
Update angular locally . This small article I am going to show you how you can easily update your local angular version to latest. I am using npm-check-updates package to update the package.json Follow the below steps.