diff --git a/addon/components/x-timer.js b/addon/components/x-timer.js index adb1455..520ff09 100644 --- a/addon/components/x-timer.js +++ b/addon/components/x-timer.js @@ -11,11 +11,19 @@ export default Ember.Component.extend({ //TODO: check the usage of this variable isRunning: false, - didInsertElement: function(){ - if(this.get("autoStart")){ + _init: function _init() { + if (this.get("autoStart")) { this.send("start"); } }, + + didInsertElement: function(){ + this._init(); + }, + + didUpdateAttrs: function didUpdateAttrs() { + this._init(); + }, showStartBtn: function(){ return this.get("isStopWatch") || !this.get("autoStart"); diff --git a/app/templates/components/x-timer.hbs b/app/templates/components/x-timer.hbs index bf039b6..5be99a8 100644 --- a/app/templates/components/x-timer.hbs +++ b/app/templates/components/x-timer.hbs @@ -1,4 +1,4 @@ -

{{duration}}

+{{duration}} {{#if showStartBtn}} {{/if}}