Why I can not use dash here?
export class FizzService {
getFizzes() : object[] {
return[
{
iconClass: 'glyphicon glyphicon-search',
},
So in above I can not use
icon-class: 'glyphicon glyphicon-search',
I must do:
iconClass: 'glyphicon glyphicon-search',
Otherwise I see error:
Property names can be strings ("foo"
) or identifiers (foo
).
Identifiers can also be used for variables.
Identifiers cannot include a hyphen because that is the minus operator.
amount-discount
means "Amount minus discount" and not "A variable with a hyphen in the name".
Identifiers can't include spaces, +
characters and a host of other characters either. Use a string if you want a property name to include a special character.