Avoid creating a complex maze of setters
Photo by Esteban Lopez on Unsplash.
Today, I want to share my thoughts on the power of using single-element collections in Angular apps. I find use cases for this very often in my daily work, so maybe you’ll find it useful also.
Let’s start with something typical:
<workitem-card *ngFor="let item of selectedWorkItems" [item]="item" >
We’ve seen such code many times and it looks very natural to us. Whenever we add a new element to the
selectedWorkItems array, Angular will initialise a new instance of the component and render it within the view. Business as usual.
Now consider this: The
selectedWorkItems collection can have either
In such a scenario, is there still a place for the
*ngFor or should we switch to a single
selectedWorkItem field on the component?
Install Angular in easy step by step process. Firstly Install Node.js & npm, then Install Angular CLI, Create workspace and Deploy your App.
What is Angular? What it does? How we implement it in a project? So, here are some basics of angular to let you learn more about angular. Angular is a Typesc
Updating from Angular 10 to Angular 11. In 2020, Angular received three stable update (Version 9, 10, and 11,) each introducing a few significant changes. We’ll focus on the last two, Angular 10 and Angular 11, the rule is currently facing issues, especially for packages like update @angular/core.