Dostęp do treści wewnątrz funkcji kontrolera ember
Mam trasę, kontroler, widok w ten sposób. Problem polega na tym, że nazwałem funkcję kontrolerareloadTime
z widoku, ale wreloadTime
funkcja pociesza zawartość dla tego kontrolera, ale tak mówiundefined
. Moje pytanie brzmi: jak uzyskać dostęp do tych treści we wrześniu?
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();
}
});