Angular

How to implement Angular ngSwitch Directive with Examples

Angular has a lot of built-in directives: *ngIf , *ngFor , *ngSwitch . These directives are so-called structural directives, which are used to transform the DOM structure.  Sometimes you need to render different elements depending on a given condition. When you run into this situation, you could solve this by using several *ngIf directives but …

How to implement Angular ngSwitch Directive with Examples Read More »

How to implement Angular renderer2 with an example

 An angular Renderer2 class is an abstraction provided by Angular in the form of a service that allows manipulating elements in our application without having to touch the DOM directly. In our previous articles, we had learned the pros and cons of using angular elementRef to directly access DOM element manipulation. An Angular app consists mainly …

How to implement Angular renderer2 with an example Read More »

Angular ContentChild and ContentChildren decorator

An Angular we have different ways of communication between components. We can query and manipulate the child element/component using different decorators that Angular provides, like @ViewChild and @ContentChild depending on where that element might occur. We need to use the angular ContentChild/ContentChildren decorator to work with the elements inside “ng-content” container. The @ContentChild decorator tells …

Angular ContentChild and ContentChildren decorator Read More »

Angular ViewChildren decorator in details

Angular ViewChild and ViewChildren decorator allow us to access and manipulate HTML elements in DOM or the child component by parent component. Angular provides different ways of communication between components. Components can query the content of their templates to locate instances of element/directive/component, which are known as view children. Angular viewChildren decorator declares a reference …

Angular ViewChildren decorator in details Read More »

Scroll to Top