ember.js - ember version 1.6.1 best to way to bind css style -
i using ember version 1.6.1. show error message if user doest not enter username , password correctly. think have use bind-style. have code this:
<fieldset class="error-message" {{bind-style visibility="isvisible:visible:hidden"}}> <span>invalid username/password</span> </fieldset>
what best way ?
ember handlebars supports dynamic class binding exceptionally better style binding. you'd bind-attr class. http://emberjs.com/guides/templates/binding-element-class-names/
css
.visible{ visibility:visible; } .hidden{ visibility:hidden; }
handlebars
<fieldset {{bind-attr class=":error-message isvisible:visible:hidden"}}> <span>invalid username/password</span> </fieldset>
example: http://emberjs.jsbin.com/didax/1/edit
you can bind-attr style property , create computed property returns raw style text visibility:visible
, that's ugly , not necessary in situation.
Comments
Post a Comment