javascript - emberjs not showing view -


i starting learn ember.js , trying integrate existing rails application. using ember-rails gem , looks ok except template not showing when call {{outlet}} in rails view. here code looks like.

rails view want ember application be

<script type="text/x-handlebars" data-template-name="application">   <h1>test</h1>   {{outlet}} </script> <div id="ember-root"> 

here ember app code:

window.resumecompanion = ember.application.create({   log_transitions: true, // basic logging of successful transitions   log_transitions_internal: true, // detailed logging of routing steps   rootelement: '#ember-root' });   resumecompanion.router.reopen({});  resumecompanion.jobsroute = ember.route.extend({})  resumecompanion.router.map(function() {   this.resource('jobs'); }); 

lastly there handlebar template located in app/assets/javascripts/templates/jobs.handlebars

<h1>jobs</h1>  <p>your content here.</p> {{outlet}} 

when run application template in jobs.hanldebars not show up. in console see this:

attempting url transition /jobs

transition #0: application: calling beforemodel hook

transition #0: application: calling deserialize hook

transition #0: application: calling aftermodel hook

transition #0: jobs: calling beforemodel hook

transition #0: jobs: calling deserialize hook

transition #0: jobs: calling aftermodel hook

transition #0: resolved models on destination route; finalizing transition.

transitioned 'jobs'

transition #0: transition complete.

ember debugger active

so think routing 'jobs' @ loss why template not seem rendering , showing up. appreciated.

after more playing found if declare in rails view

<script type="text/x-handlebars" data-template-name="jobs">   <h1>jobs</h1>   {{outlet}} </script> 

then renders template , shows correctly. maybe there naming problem not aware of in template?

thanks,

josh

when define route or resource in router, want refer template. if don't have template name, there nothing render. assumption correct, need "jobs" template correspond router code.

here post on difference between routes , resources if you're interested.

http://blog.trackets.com/2013/02/01/ember-dot-js-router-and-template-naming-convention.html


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -