我有一个这样的控制器。在 reloadTime 函数中,我想修改此控制器内容的键的值。
App.ActivecallsController = Ember.ArrayController.extend({
activeCalls:[],
//obj:[],
deleteCall:function(model){
var obj = this.findProperty('ID',model.ID);
App.Cdrglobal.set('active_call',App.Cdrglobal.active_call-1);
this.removeObject(obj);
},
reloadTime:function(){
var self=this;
var inter = setInterval(function(){
$(self.get('content')).each(function(k,v){
self.set(self.content[k]['duration'],'00');
clearInterval(inter);
});
},1000);
}
});
内容是
[{"ID":1,"from_number":"1231654","carrier_ip":"123.156.12.1","to_number":"156816548","gw_ip":"156.245.15.12","duration":"12:14"},{"ID":2,"from_number":"1231654","carrier_ip":"123.156.12.1","to_number":"156816548","gw_ip":"156.245.15.12","duration":"15:44"},{"ID":3,"from_number":"1231654","carrier_ip":"123.156.12.1","to_number":"156816548","gw_ip":"156.245.15.12","duration":"52:24"},{"ID":4,"from_number":"1231654","carrier_ip":"123.156.12.1","to_number":"156816548","gw_ip":"156.245.15.12","duration":"52:20"}]