Skip to content

Angular

ngOnChanges Cover

Using ngOnChanges

ngOnChanges is a lifecycle hook that is being invoked every time a variable decorated by @Input changes. We are intercepting and handling changes inside a ngOnChanges(changes: SimpleChanges) method. We are using the SimpleChanges API, an interface that represents all the changes stored by a particular… Read More »Using ngOnChanges

Angular Renderer Cover

Angular Renderer

In past articles, we used the nativeElement to directly query and modify the DOM. Querying native elements by bypassing any abstraction may come with a couple of problems though. For example, by using native element methods, we can’t execute modifications in non-DOM environments such as… Read More »Angular Renderer

Angular ViewChildren Cover

Angular ViewChildren

Following in the footsteps from @ContentChild and @ContentChildren, we need to utilize the power of a live list in order to configure multiple live queries for @ViewChild. And we have just the right decorator. It is called @ViewChildren. @ViewChildren We use @ViewChildren to configure a… Read More »Angular ViewChildren

Angular View Child Cover

Angular ViewChild

We are not stopping with the decorators here. The next one we’ll tackle is the @ViewChild. Additionally, you can get a refresher on @ContentChild and @ContentChildren. We’ve seen how @ContentChild and @ContentChildren work. Components are queried based on what we pass inside the component tags.… Read More »Angular ViewChild

Angular Content Children Cover

Angular ContentChildren

After we mentioned ContentChild in the last post, we will move our focus onto ContentChildren, whose only difference is that instead of selecting only one element – it selects a QueryList of elements from the DOM. (Wait, what is a QueryList? QueryList is an unmodifiable… Read More »Angular ContentChildren

AngularContentChild Cover

Angular ContentChild

ContentChild is a property decorator in Angular that configures a content query or retrieves a reference to a projected content. We can use ContentChild in order to retrieve the first element (template reference, component, or directive) matching the selector from the DOM. We can define… Read More »Angular ContentChild