ember.js - EmberJS: Updating property inside object -
little , strange issue. have array of objects. here controller.
ambiantbox.ambiantscontroller = ember.arraycontroller.extend({ myarray: [], filldata: function(){ //loop this.myarray.push({index: 0, status: 'hide'}) //loopend }, updatestate: function(idx){ arr=this.get('myarray'); for(i=0;i<arr.length;++i){ obj=arr[i] if(obj.index==idx){ console.log(idx); obj.set('status','show'); console.log('==========='); }}} });
i call updatestats function viewside. works fine till line console parameter idx code seems break set object. there no errors in console well.
strange. appreciated.
if want use ember's set
, get
's it's idea use ember.object
, ember.array
well.
try this:
ambiantbox.ambiantscontroller = ember.arraycontroller.extend({ myarray: em.a(), filldata: function(){ obj = ember.object.create({index: 0, status: 'hide'}); this.myarray.pushobject(obj); }, });
Comments
Post a Comment