Blog

Since Angular 4.3, the Angular framework offer a new HTTP client named HttpClient. This HTTP client put forward a new interceptor mechanism. But, it turns out that this mechanism is common to the entire application. Assume that you have to consume two Rest API from 2 different providers. With the…

Since Angular 5 ang Angular CLI 1.5, Typescript files are no longer emitted on AOT compilation. Indeed, with Angular CLI 1.5, a new Webpack plugin arrived: AngularCompilerPlugin. This last is specially used when we compile an Angular 5+ application. Previously, we used another Webpack plugin: AOTPlugin. The consequence is that the compiler no…

Sometimes, we have to fetch datas before our application boostrap is started. It happens when we have to fetch a server configuration before calling an API. Angular offers a poorly documented system : the APP_INITIALIZER provider. APP_INITIALIZER is a multi provider, that is, a provider that accepts several values. But this provider is special…

When we use a structural directive as *ngIf, we use a sugar such as : <div *ngIf="true">Hello World !</div> Before it will be rendered, it will be "de-sugared" : <ng-template [ngIf]="true"><div>Hello World</div></ng-template>​ But, if you just want to show "Hello World" without to wrap it with another element in the…

When you want to add dynamic content in a fixed view template, you should think Transclusion. This mecanism allow you to define a hook for dynamic content by using <ng-content> tag. For exemple, CardComponent is a component that uses this mechanism : View the code on Gist. We can see this component as…