Kirankumar Pyati
Kirankumar Pyati

Reputation: 48

In Ember.js updating the controller property will not update the view'

I am using the controller property as array initially the view will render once after updating the array the view is not getting updated.

Eg:

Handlebar:

{{#each records}}
    {{name}}
{{/each}}

Controller:

App.recordsController = App.EventHandlerController.extend({
records: null,
actions:{
//stmt1 
var array = ["test", "test2"];
this.set('records', array);
//stmt2
array.push("data");
this.set('records', array);
}

});

The view is not getting updated after statement 2 What is the reason for this?

Upvotes: 1

Views: 110

Answers (1)

Steve H.
Steve H.

Reputation: 6947

This is failing because it is not valid JavaScript. The object passed to extend is a JavaScript object, which consists of keys and values. After records: null,, you have code that looks like it belongs in some function. You should have seen an error in your console describing this.

Upvotes: 0

Related Questions