I'm iterating over itemControllers init functions verifying a specific condition. What should I do if I want to stop iterating when the condition has changed? By iterating, I mean going over every single itemController inits function. Example :
init: function(){
if(getCurrentConvId()){
var self = this;
return;
if(self.get('model').id == getCurrentConvId()){
self.get('controllers.conversation').set('selectedConv', this.get('model'));
self.send('clickConv', self.get('model'));
**Here I would like to stop iterating because conv has been found**
}
}
},
An idea I had was to put an observer on a convFound property in the ArrayController but the problem is that the code on init functions will be executed before the observer is even part of the app. Any suggestions?
Aucun commentaire:
Enregistrer un commentaire