Im triying to show a specific bootstrap tap, when refresh the browser, if the records of my model doesn’t meet a condition.
In the aftermodel i determinate what tab must show, and i called a action from the controller to show the tab with jquery, but looks like the template has not been loaded.
The aftermodel is:
afterModel: function(pendingTrader) {
var countPending = 0;
var countConfirmed = 0;
var firtsConfirmed = null;
for(var i = 0; i < pendingTrader.get('length'); i++){
if(!pendingTrader.objectAt(i).get('isConfirmed')){
countPending++;
this.controllerFor('portfolio').send('updateDefaultPerformance', pendingTrader.objectAt(i));
break;
}else{
countConfirmed++;
if(countConfirmed === 1){
firtsConfirmed = pendingTrader.objectAt(i);
}
}
}
if((countPending === 0) && (countConfirmed > 0)){
this.controllerFor('portfolio').send('updateDefaultPerformance', firtsConfirmed);
}
}
And the controller action:
updateDefaultPerformance: function(pTrader){
this.send('setPerformance', pTrader);
if(pTrader.get('isConfirmed')){
console.log("Set default a followedActive");
$('a[href=#followed]').tab('show'); // this doest'n work
}else{
console.log("Set default a pendingActive");
}
}
whats happening? how i can execute the action when the template is really loaded?