Overview
Some Meteor Blaze helpers for HTML manupulations.
Installation
meteor add imajus:html-helpers
Related packages
Contents
Package provides following global Blaze helpers:
dump(...args)– Returns JSON-fiedargsas a string.
1<pre>{{dump currentUser currentRoute}}</pre>
activeClass(current, expected, initial)– Whencurrentequalsexpected, returns'active'string literal. Ifinitialvalue istrue, helper returns'active'for emptycurrentvalue as well. To be used in lists-like interactive UI components, like menus.
For more general helper which you can use to return other string literal rather than 'active', see when from imajus:common-helpers.
1<ul class="menu"> 2 <li class="{{activeClass currentRoute 'home' true}}">Home</li> 3 <li class="{{activeClass currentRoute 'contact'}}">Contact Us</li> 4 ... 5</ul>
numberClass(num)– Returns one of'positive','negative'or'zero'literal values depending onnumvalue.selected(current, expected, initial)– Addsselectedattribute whencurrentequalsexpected. Ifinitialvalue istrue, helpers will also adds attribute in case ofcurrentis empty.
1<select> 2 <option {{selected value 'first' true}}>First</select> 3 <option {{selected value 'second'}}>Second</select> 4</select>
checked(current, expected, initial)– Addscheckedattribute whencurrentequalsexpected. Ifinitialvalue istrue, helpers will also adds attribute in case ofcurrentis empty.
1<input type="radio" {{checked value 'first' true}}> First 2<input type="radio" {{checked value 'second'}}> Second
disabled(current, expected, initial)– Addsdisabledattribute whencurrentequalsexpected. Ifinitialvalue istrue, helpers will also adds attribute in case ofcurrentis empty.
1<button {{disabled value 'first' true}}>First</button> 2<button {{disabled value 'second'}}>Second</button>