1

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="{{session.isAuthenticated}}" click='logout' Logout

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

Ali Ghanavatian
  • 506
  • 1
  • 6
  • 14

1 Answers1

0

This should work:

button disabled={if session.isAuthenticated false true}
downx3
  • 9
  • 1