moamenezzat
moamenezzat

Reputation: 129

Modifying model's observed properties in action Ember

I have a search results page with the retrieved search results stored in the model as results. on the same page, I have a button to check all the results for extraction.

I have a property named checked and initially, it is set to falsein the button action I want to change this property on each result to true.

this is my action

checkAll(){
      this.controller.get("model.results").map(doc=>{
        doc.checked = true;
      })
    }

but I keep getting this error:

Assertion Failed: You must use Ember.set() to set the checked property (of [object Object]) to true.

I don't how to use Ember.set() only on that property. and I don't know if this is the right way to go about this as I'm new to ember.

any help would be much appreciated. Thank you.

Upvotes: 0

Views: 47

Answers (1)

Suresh Kumar
Suresh Kumar

Reputation: 74

You need to use Ember's set function to set properties to an object.

Like this, Ember.set(doc, 'checked', true);.

Upvotes: 2

Related Questions