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...
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?
Computed properties are currently not supported in templates.
Template may be refactored to not use computed properties:
(ngModelChange)="action.emit({type: 'CACHE_SELECTED_COMPANY', payload: getPayload(selectedCompany.id})"
Or entire action.emit(...)
may be moved to model change callback.