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

Computed not called and `model.hasDirtyAttributes`

$
0
0

@Myrdhin wrote:

Hello Perhaps could you help me to understand: I have a computed like this in my controller :

isBtnSaveDisabled: computed(
    'model.hasDirtyAttributes',
    function() {
        // CODE
    }
).readOnly()

When I update an attribute (DS.attr) in my model , this computed is not called ( isBtnSaveDisabled is present in my template!).

BUT, If I rewrite this computed like this :

isBtnSaveDisabled: computed(
    'model.currentState.isDirty',
    function() {
        // CODE
    }
).readOnly()

It works :crazy_face: !? Why ? hasDirtyAttributes is a computed which depends of currentState.isDirty ? I don’t understand…

I forgot to specify: we use Ember 3.12 (an update is planned but not immediately)

And if I exec $E.get('model.hasDirtyAttributes')in my js console ( $E is my controller) , my first computed works (the computed with model.hasDirtyAttributes)…

Strange :alien: !

Thanks for your help.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles