After a long discussion, Angular finally introduced a new Control Flow Syntax in version 17.
This new syntax allows developers to apply conditional logic and loops directly in the template, without the need for structural directives like *ngIf and *ngFor.
It’s simply closer to the syntax used in languages such as Typescript and JavaScript, making it easier to read and understand.
The new @for uses a new diffing algorithm that improves by 90% the runtime performances (read the v17 announcement for more details).
When using update, pay attention to functions providing side effects such as Array.splice().
this.importFileList.update((v) => v.splice(index, 1));This won’t work as expected because Array.splice() modifies the array in place. Instead, you should use Array.filter():
this.importFileList.update((v) => v.filter((_, i) => i !== index));or if you prefer, you can use Array.slice():
const newArray = [...this.importFileList().splice(index, 1),];
this.importFileList.set(newArray);