Reputation: 537
I have this code which works
if (activePage === 'index')
a.active(href="index.html") Index
else
a(href="index.html") Index
I'd like to short it with something like :
- var vclass = #{activePage==='popol' ? 'active' : ''};
a(class=#{vclass}) Index
or better something like
a(class=#{activePage==='index' ? 'active' : ''}) Index
Upvotes: 0
Views: 52
Reputation: 334
I think this code should work and is better
a(href='index.html' class=activePage === 'index' ? 'active' : '') Index
Upvotes: 2