dimanche 21 août 2016

How to make a button disabled by condition in emblem.js?

I am trying to use Emblem.js to make a button disabled by condition. I have tried this and it worked:

if session.isAuthenticated
  button.ui.large.button.primary click='logout' Logout
else
  button.ui.large.button.primary disabled='true' click='logout' Logout

but I could not make it happen in a line. I have tried these with no success:

button.ui.large.button.primary{bind-attr disabled="session.isAuthenticated"} click='logout' Logout

button.ui.large.button.primary disabled=session.isAuthenticated click='logout' Logout

button.ui.large.button.primary disabled="" click='logout' Logout

I wonder if there is a short way to do this?




Aucun commentaire:

Enregistrer un commentaire