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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -