1

I'm working on a project made with Ember.js I'm using ember-paper addon for buttons and also Ember-intl addon to translate my application (English and French).

I have a basic HTML button with this code:

<button class={{if model.active "active"}} {{action "changeLocale" model.locale}}>{{model.locale}}</button>

But when I use ember-paper with this kind of code :

{{#paper-button accent=true}}Test{{/paper-button}}

I can't find a way to add my if statement and the action.

{{if model.active "active"}} {{action "changeLocale" model.locale}}>

Do you know how to do that?

Suraj Kumar
  • 5,547
  • 8
  • 20
  • 42
Elena
  • 55
  • 10

1 Answers1

1

Working Twiddle

1) You can call your action using onClick option inside {{#paper-button}} component.

2) You can use disabled and accent boolean options to set true or false based on your condition model.active

{{#paper-button
  onClick=(action "someAction")
  accent=true
  disabled=(unless model.active true)
  accent=(if model.active true)
}}
  Test
{{/paper-button}}
rinold simon
  • 2,782
  • 4
  • 20
  • 39