Girja Shanker
Girja Shanker

Reputation: 85

show hide button depending on time in ember.js

How to hide the button for 5s in ember.js

This is my template activation.hbs

{{#if hideResendCode}}
  {{#paper-button raised=true primary=true}}Resend Code{{/paper-button}}
{{/if}}

and this is my controller activation.js

hideResendCode:Ember.run.later((function() {

 }), 5000),

I don't know how to hide this button for 5s please help me.

Upvotes: 1

Views: 400

Answers (1)

Ebrahim Pasbani
Ebrahim Pasbani

Reputation: 9406

You need to run scheduler in init.

{{#if showResendCode}}
  {{#paper-button raised=true primary=true}}Resend Code{{/paper-button}}
{{/if}}

And

    //activation.js
    showResendCode: true,

init(){
  this._super(...arguments);
    Ember.run.later(this, function() {
          this.set('showResendCode', false);
        }, 5000);
}

Upvotes: 0

Related Questions