@nightire wrote:
It is common to give a default value for a component argument, then allow users to pass a new value to overwrite it, but it doesn’t work as it should be if you use es2015 syntax.
For example
export default class FooBar extends Component { name = 'default'; }
{{foo-bar}} {{!-- name is "default" --}} {{foo-bar name="nightire"}} {{!-- name is still "default"}}
there is a workaround:
export default class FooBar extends Component.extend({ name: 'default' }) { }
{{foo-bar}} {{!-- name is "default" --}} {{foo-bar name="nightire"}} {{!-- name is "nightire" now}}
but I’m wondering why? and is there a better solution exists?
Posts: 3
Participants: 3