ngClass example in angular 5
The ngClass too works on the same lines, except that it is used to toggle one or multiple classes. For example, check out the following code: import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-ngclassex', templateUrl:...
ngStyle in angular with example
With the NgStyle directive, you can set a given DOM element CSS properties from Angular expressions. The simplest way to use this directive is by doing [style.]="value". For example: Uses fixed yellow background This snippet is using the NgStyle directive to set the...
angular life cycle hooks
Lifecycle hooks are the way Angular allows you to add code that works before or after each step of the routing life cycle or components or we can say that desired code may be injected into components and code will execute during component's life cycle events. Each...
angular 4 providers example – How to create custom class and add reference into component
In this article, I am going to demonstrate that how we can use angular providers to add custom class and its properties and functions into another component. Example: Step1: First we will create a new typescript file with ".ts" extension which represents our custom...