The ember js component counter does not work

I have a script in the emberjs component where the observation does not fall. I understood the reason as "the component is not yet inserted when the component property is set."

My questions are: can this be handled better in ember js?

A better explanation can be found in jsbin`s below.

The script does not work

Working scenario

+6
source share
1 answer

You can specify .on('init') to make observers work immediately after initialization; otherwise, for example, @ Kingpin2k - they do not start

 App.TextboxDisplayComponent = Ember.Component.extend({ displayText: '', boundProperty: '', observeBoundProperty: function () { this.set('displayText', this.get('boundProperty')); }.observes('boundProperty').on('init') }); 

Your (non) working example is here

+14
source

Source: https://habr.com/ru/post/980600/


All Articles