Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

constructor arguments always gets Spacebars.kw, even if no "foo=bar" style arguments. #123

Open
JesperWe opened this issue Mar 20, 2016 · 1 comment

Comments

@JesperWe
Copy link
Contributor

When a component is included using {{> component args 'foo' 'bar' }} style, the constructor is called something like this: component.constructor( 'foo', 'bar', new Spacebars.kw() )

This caused me a bit of confusion when I wanted an optional last argument to the constructor, since omitting it from the template instanciation did not make it undefined, but rather gave me the empty Spacebars keyword hash.

I thing either the hash should not be in the argument list if it is empty, or the docs should say that it is always the last argument, to avoid similar confusion in the future.

@mitar
Copy link
Member

mitar commented Mar 21, 2016

Because this is also how template helpers in general operate (so all class methods) I think I will go with documenting this instead of changing the behavior. But I agree it is ugly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants