Tip
Guest tip provided by Robbie from https://twitter.com/shipshapecode
Tired of the pesky divs that ember wraps every component in that you create throwing off your styles and cluttering the DOM?
You can set tagName, in your component.js, to change it to whatever you want. You can make it any valid tag, for example:
1 2 3 |
export default Ember.Component.extend({ tagName: 'span' }); |
You can even make tagless components by setting it to empty string:
1 2 3 |
export default Ember.Component.extend({ tagName: '' }); |
This means there will be no wrapper created for your component and only the markup in the template.hbs will be rendered for that component.
Credits & Links
Thanks Robbie – https://twitter.com/shipshapecode
My Latest Side Project
Hire JS – Top Javascript Developers
Hire JS is a community of top Javascript developers and top javascript jobs. We have top quality javascript, web, mobile, angular, react, ember and node developers. We have remote jobs, full and part time jobs, contracts. Save yourself time, effort and money and find the perfect developer and project.
Share A Tip
Email me at emad@emberdaily.tips if you have a good ember tip.
If you are enjoying my daily tips please spread the word with this one-click tweet.
If you do NOT like the tips then please reply to this email and let me know how I can improve them.