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

Cannot pass HTML attrs to component #279

Open
mehulkar opened this issue Jun 5, 2019 · 2 comments
Open

Cannot pass HTML attrs to component #279

mehulkar opened this issue Jun 5, 2019 · 2 comments

Comments

@mehulkar
Copy link

mehulkar commented Jun 5, 2019

I would like to do this:

<ModalDialog data-test-foobar />

But the component does not use the HTML attrs passed to the component :(

@mehulkar
Copy link
Author

mehulkar commented Jun 5, 2019

Since an inner component is invoked using the component helper, I think the best way to solve this would be to change modal-dialog.hbs to this:

{{#let (component modalDialogComponentName) as |InnerComponent|}}
  <InnerComponent ...attributes>
{{/let}}

and then in each inner component, also add ...attributes.

I am not 100% sure what version of Ember is required to make this work, and if older versions would silently ignore it or not.

Would be up for making a PR if this is a good approach!

@mehulkar
Copy link
Author

mehulkar commented Jun 5, 2019

Here's a sample repo showing how it would work: https://github.com/mehulkar/ember-example-inner-component-slat-attrs

(ember-twiddle latest Ember is 3.4, which doesn't seem to support splattributes inside a let block, but here's that as well: https://ember-twiddle.com/16113c250d089fcacbfc89e01f059d49?openFiles=styles.app.css%2Ctemplates.components.baz-bar.hbs)

@mehulkar mehulkar mentioned this issue Dec 7, 2019
3 tasks
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

1 participant