Angular >2 Dynamic object key causing template parse error

Viewed 628

When trying to place a value for a key, with a variable inside of my event binding expression, I am given a template parse error: Parser Error: Unexpected token [, expected identifier, keyword, or string at column... error img my expression is: (ngModelChange)="action.emit({type: 'CACHE_SELECTED_COMPANY', payload: { [selectedCompany.id]:{selected: true, details: false}}})"

I thought that providing a variable name for a key in [square brackets] was allowed, and my question is, should I be able to provide a variable as a key in an Angular 2 template's, event binding expression?

1 Answers
Related