I was curious if I should use the Ember tagName option or simply use HTML? For example, on my navbar I could do:
{{#link-to 'index' tagName = 'li'}}Home{{/link-to}}
{{#link-to 'about' tagName = 'li'}}About{{/link-to}}
or I could do:
<li>{{#link-to 'index'}}Home{{/link-to}}</li>
<li>{{#link-to 'about'}}About{{/link-to}}</li>
Are there pros and cons to each? When should I use which? Thanks!
Use the latter if possible. I say that because I think itβs good practice to keep links on a tags. I do, however, use a form of the first one when using Bootstrap, since Ember.js places an active class on the current URL links.
{{#link-to 'index' tagName='li' href=false}}
{{#link-to 'index'}}Home{{/link-to}}
{{/link-to}}
But notice that I disable the href on the li tag so the a tag is the one that is clicked. (Iβm not even sure if having an href property on an li will work in all browsers.)
1 Like