我有这样的路线,控制器,视图。问题是我reloadTime
从视图中调用了控制器函数,但在reloadTime
函数中我控制了这个控制器的内容,但它说它是undefined
。我的问题是如何在 ember 中访问此内容?
App.ActivecallsRoute = Ember.Route.extend({
setupController:function(controller,model){
$.ajax({
url:'requests/activecalls.php',
type:'POST',
success:function(data){
App.Cdrglobal.set('active_call',data.length);
controller.set('content',data);
}
})
}
});
App.ActivecallsController = Ember.ArrayController.extend({
content:[],
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(){
console.log(this.get('content'));//console undefined
console.log(this.content);console undefined
}
});
App.ActivecallsView = Ember.View.extend({
didInsertElement:function(){
this.get('controller').reloadTime();
}
});