FrancescoDonzello
Angular Share on Twitter

What you need to know about Angular Signals

1 minutes read •
#articles#angular#signals

Introduction

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.

Good bye structural directives

The new @for uses a new diffing algorithm that improves by 90% the runtime performances (read the v17 announcement for more details).

update()

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);
← Back to Kubernetes Articles

Was it helpful?

Tell your friends or co-workers.