Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4840

Component Property is not getting updated

$
0
0

@JKP wrote:

I have a component property in my component.js based on which i will show/hide some data in template.hbs

Case1: By default the componentProperty (canShow) is true, but based on some change in data it will be set false in another computed property.

    dataChanged: computed( 'data', 'canShow', function () {
        if(it is true) { 
            this.set('canShow', false);
         }
    });

Expected: Canshow should be false, so the data in template should be hidden Result: It is getting updated as false, But in template the data is still showing

Case2: I have tried this with getter and setter in computed.

canShowTemplateData: computed('canShow', {
   get() {
      return this.get('canShow');
    },
    set(key, value) {
      return value;
    }
});

Even in this case, set is working fine. But the value is not at all updated in template using get() function. Also pls clarify while using set(), which value should be updated either canShow or canShowTemplateData?

Am I missing something? Or is there any other way to handle this?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4840

Trending Articles