lundi 23 juin 2014

Call custom function when view is rendered, from one place and not repeating code for every view


Vote count:

0




in ember application i want to call my costum function which does some modifications of dom elements, the only solution i found is to repeat below code as many times as many views/routes i have


for example


rendering indexView



indexView = Ember.View.Extend({
didInsertElement:function(){
//my costum function call goes here.. myFunction();
}
});


rendering OtherView



OtherView = Ember.View.Extend({
didInsertElement:function(){
//my costum function call goes here.. myFunction();
}
});


rendering MoreView



MoreView = Ember.View.Extend({
didInsertElement:function(){
//my costum function call goes here.. myFunction();
}
});


so, is there a way of calling myfunction globaly whenever any view is rendered? i releay do not want to repeat code for every single view i redner.


thanks!



asked 34 secs ago






Aucun commentaire:

Enregistrer un commentaire