It's unlikely that you're going to get this syntax to work in a template (there are many valid typescript constructs that don't work in templates).

You could write a helper method in the component instead, that takes the item as an argument, and then makes the appropriate call, as in, for example:

public doCommand(item: ToolbarItem): void {
  item.command(...item.commandParams);
}

and then change your template to:

<button (click)="doCommand(item)"...
Answer from GreyBeardedGeek on Stack Overflow
🌐
C# Corner
c-sharpcorner.com › blogs › spread-and-rest-operators-in-angular
Spread and Rest Operators in Angular
July 29, 2024 - The spread operator (...) expands elements of arrays or objects, useful for combining data. The rest operator (...) collects multiple elements into an array, aiding in parameter handling and destructuring.
Discussions

Support spread operator (`...`) in Angular templates (e.g., for `[class]` binding)
Which @angular/* package(s) are relevant/related to the feature request? core Description It would be very useful to allow the use of the JavaScript spread operator (...) within Angular templates, ... More on github.com
🌐 github.com
7
June 1, 2025
Angular-How to use spread operator in angular html template
I have a simple angular app with a module and a component. For the sake of simplicity let us assume that the component ts and the template file is like the following snippet import { Compon... More on stackoverflow.com
🌐 stackoverflow.com
angular - RxJS : how to understand the spread operator here? - Stack Overflow
I want to know how this part works with the spread operator ... More on stackoverflow.com
🌐 stackoverflow.com
August 13, 2022
typescript - Can you use spread operator in the template in angular - Stack Overflow
Can you use spread operator in the template in angular? I have seen this question and answer. The accepted answer says it is impossible to do so: It's unlikely that you're going to get this synt... More on stackoverflow.com
🌐 stackoverflow.com
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Operators › Spread_syntax
Spread syntax (...) - JavaScript - MDN Web Docs - Mozilla
May 22, 2026 - The spread (...) syntax allows an iterable, such as an array or string, to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected. In an object literal, the spread syntax enumerates the properties of an object and adds the key-value ...
🌐
GitHub
github.com › angular › angular › issues › 61800
Support spread operator (`...`) in Angular templates (e.g., for `[class]` binding) · Issue #61800 · angular/angular
June 1, 2025 - area: compilerIssues related to `ngc`, Angular's template compilerIssues related to `ngc`, Angular's template compilercore: basic template syntaxstate: has PR ... It would be very useful to allow the use of the JavaScript spread operator (...) within Angular templates, especially for object bindings like [class], [style]
Author   angular
🌐
YouTube
youtube.com › watch
💥 The Typescript Object Spread Operator - YouTube
This video is part of the Typescript: The Ultimate Bootcamp Course - https://angular-university.io/course/typescript-bootcampCheck out the PDF E-Books avail...
Published   June 22, 2022
🌐
YouTube
youtube.com › code with z
Mastering the Spread Operator for Arrays & Objects in JS | Part 9 | JavaScript for React & Angular - YouTube
Unlock the full potential of the Spread Operator in JavaScript with our in-depth tutorial! 🌟 The Spread Operator is a powerful tool that simplifies working ...
Published   May 27, 2024
Views   107
Find elsewhere
🌐
w3tutorials
w3tutorials.net › blog › how-to-use-spread-operator-in-angular-component-template
How to Use the Spread Operator in Angular Component Templates to Pass Arrays to Functions — w3tutorials.net
The spread operator is a versatile tool that simplifies passing array elements to functions in Angular templates. By using ...array, you can avoid manual indexing, handle dynamic argument lists, and write cleaner, more maintainable templates.
🌐
GitBook
basarat.gitbook.io › typescript › future-javascript › spread-operator
Spread Operator | TypeScript Deep Dive
December 31, 2019 - The main objective of the spread operator is to spread the elements of an array or object.
🌐
YouTube
youtube.com › shorts › Pc51dDsWd7Q
What is Spread Operator in Angular? | Simplifying Code with Angular - YouTube
In this short tutorial, we'll explore the Spread Operator (...) in Angular, a powerful tool for managing arrays and objects efficiently. Learn how to combine...
Published   November 15, 2024
Views   711
Top answer
1 of 3
1

From what I understand the spread operator works both to add new keys to an object and to overwrite the keys it already has.

I imagine a product object like this:

product = {
  price: 0,
  category: a
};

Now we copy the object with the spread operator:

const product2 = {...product};

Now you have another object (in another memory location) with the same content as product.

Now we create a new object with other values with the spread operator:

const produc3 = { ...product, price: 1, category: b };

Now you have an object that has the same keys as the original but with other values.

Now we add a new key to the object:

const product4 =  { ...product, name: 'car'};

Now you have an object that has the same keys as the original object, plus the name key.

You will never have an object with 2 keys the same.

Tested in the chrome console, if you try to define an object with two equal keys only the last key of the definition prevails.

2 of 3
1

It is a JavaScript feature not RxJS specific per say. I think this snippet of code (or similar) is part of RxJS examples slides of Deborah Kurata conference or something like this. If you are interested, there is a record on youtube on a similar usage of this syntax with RxJS by Deborah Kurata. As mentioned on MDN:

Spread syntax can be used when all elements from an object or array need to be included in a new array or object, or should be applied one-by-one in a function call's arguments list. There are three distinct places that accept the spread syntax:

Function arguments list (myFunction(a, ...iterableObj, b))

Array literals ([1, ...iterableObj, '4', 'five', 6])

Object literals ({ ...obj, key: 'value' })

In our case above it is called shallow cloning with Object literals. Read more here

🌐
CodeSandbox
codesandbox.io › s › spread-operator-in-angular-5hvpyk
Spread Operator in Angular - CodeSandbox
January 15, 2023 - Spread Operator in Angular by mr.viral.coder using @angular/animations, @angular/common, @angular/compiler, @angular/core, @angular/forms, @angular/platform-browser, @angular/platform-browser-dynamic, @angular/router, bootstrap
Published   Jan 13, 2023
Author   mr.viral.coder
🌐
W3Schools
w3schools.com › react › react_es6_spread.asp
React ES6 Spread Operator
The JavaScript spread operator (...) copies all or part of an existing array or object into another array or object.
🌐
CoreUI
coreui.io › answers › how-to-use-spread-operator-in-javascript
How to use spread operator in JavaScript · CoreUI
November 7, 2025 - Here ...arr1 and ...arr2 expand ... 3, d: 4 }. The spread operator creates shallow copies, making it perfect for immutable updates, function argument passing, and avoiding array/object mutation....
Top answer
1 of 1
2

I will explain everything to you: Spread operator will copy all of your object {keys,values} (except some advanced types like symboles) and assign it to a new variable (means a new reference or lets say a new memory address reference).
To more clarification: Of course there is a big difference between using spread and without spread operator i will give you an example:

lets say: this.availableExercises has a memory address of 0xAABBCCDD so:
this.exercisesChanged.next(this.availableExercises); ==> this line will pass the 0xAABBCCDD address to the .next(..) method to be handled after by some codes.
but if we use spread operator like:

this.exercisesChanged.next({...this.availableExercises}); ==> this will generate a copy of the {keys,values} means a new object of your previous 0xAABBCCDD addressed object, and assign it to a new reference (new memory address) like 0x99FF1155.
To understand what i meant look at this example:

let myOldReference = this.availableExercises; // memory address: 0xAABBCCDD 
this.exercisesChanged.next(myOldReference); // .next(0xAABBCCDD);

let myNewReference = {...this.availableExercises}; // this will generate a copy to a new memory address: 0x99FF115
this.exercisesChanged.next(myNewReference ); // .next(0x99FF115);

so that myOldRefernce !== myNewReference because 0xAABBCCDD is different to 0x99FF115 as references. But keep in mind, this will keep the same {keys, values} because it's a copy of keys values, but with different memory references.

That's why you see the same keys,values, but in backgroud, it's different references.

🌐
GitHub
github.com › angular › angular › issues › 11850
Use the spread operator in template · Issue #11850 · angular/angular
September 23, 2016 - I'm submitting a ... (check one with "x") [x] feature request It would be great to be able to use the spread operator in a template : Clickiclick
Author   angular
🌐
X
x.com › angular › status › 2014382553868669322
Angular - ️ Object literals
January 22, 2026 - Spread syntax in templates [...] You can now use the spread/rest operator (...) inside Angular templates. This works in the following scenarios: ▶️ Object literals: {a: 1, ...foo} ▶️ Array literals: [1, ...foo] ▶️ Function calls: fn(1, ...foo) Angular handles this efficiently https://t.co/8pK3W3MtD1
🌐
Reddit
reddit.com › r/angular › alternative to "spread" operator from react
r/angular on Reddit: Alternative to "spread" operator from React
March 19, 2020 -

I want to build a component on top of a existing one from Angular Material. Ex: A Custom Button built on top of Material Button. In React the straightforward solution is wrapping the material component and spread the props in the wrapped component

<CustomComponent /> = (props) =>  <MaterialComponent {...props} />

Is there a way to do something similar with Angular? Thanks in advance (:

(non english speaker here, I tried my best to express my idea)