Angular 21.1: Spread Operator in Templates
Angular 21 just dropped, and the star feature is the template spread operator (`…`). Say goodbye to verbose array/object handling, now you…
Angular 21.1: Spread Operator in Templates
Angular 21 just dropped, and the star feature is the template spread operator (…). Say goodbye to verbose array/object handling, now you can spread them right in your templates!
Real-World Examples
- Array Spreading:
HTML:
@let users = [currentUser, …admins];
@for (user of users; track user.id)
{ <div>{{ user.name }}</div> }
@empty { <div>No users found.</div> }
- Array Spreading:
2. Function Calls with Rest/Spread Params:
Just like in TS/JS, you can spread arrays into function parameters:
HTML:
<button (click)=”handleClick(…items)”>Click me</button>
These additions bring template expressions closer to real JavaScript syntax, making them more powerful and reducing the need for boilerplate helpers in the component class.
메타데이터
- post_id
- ca7ce4ebf907
- slug
- angular-21-1-spread-operator-in-templates-ca7ce4ebf907
- url
- https://medium.com/@soumyabpujari12/angular-21-1-spread-operator-in-templates-ca7ce4ebf907
- canonical_url
- https://medium.com/@soumyabpujari12/angular-21-1-spread-operator-in-templates-ca7ce4ebf907
- author_url
- https://medium.com/@soumyabpujari12
- status
- ok
- fetched_at
- 2026-06-16 19:09:56