Ember.js {{render}} Helper renders corresponding View twice? -
i've got app want render info bar user within application.hbs
this:
{{render "userinfobar"}} {{outlet}} <footer id="footer-info">copyright me</footer>
i created userinfobarcontroller
, userinfobarview
classes both derive corresponding ember classes , write log output init()
function of both. now, occurs userinfobarview
s init()
method gets called twice! first time gets called before init()
method of userinfobarcontroller
, after controller initialized gets called again. therefore i'm unable set elementid
userinfobarview
, because first initialized userinfobarview
inserted before...
here's log output gets generated:
userinfobarview:: init() called... userinfobarcontroller:: init() called... userinfobarview:: init() called... userinfobarview:: inserted dom...ember195 userinfobarview:: inserted dom...ember198
this controller:
app.userinfobarcontroller = ember.objectcontroller.extend({ init: function() { console.debug('userinfobarcontroller:: init() called...'); } });
this view:
app.userinfobarview = ember.view.extend({ tagname: 'div', classes: ['container', 'centered'], init: function() { console..debug('userinfobarview:: init() called...'); }, didinsertelement: function() { console.debug('userinfobarview:: inserted dom...' + this.$().attr('id')); } });
edit:
here's userinfobar
template:
{{#view app.userinfobarview}} <div id="userinfobardetails1"> </div> <div id="userinfobardetails2"> </div> <div id="userinfobardetails3"> {{controller.fullname}} </div> {{/view}}
why userinfobarview
gets rendered twice?
Comments
Post a Comment