Note that there are some explanatory texts on larger screens.

plurals
  1. PORails 4: Ember.js doesn't see my templates?
    text
    copied!<p>I am trying to just render a template from <code>templates/about.handlebars</code>.</p> <p>I have the outlet setup in rails view:</p> <pre><code>%script{ type: 'text/x-handlebars'} &lt;h1&gt; My app&lt;/h1&gt; {{ outlet }} ^-- outlet </code></pre> <p>the about route looks like this:</p> <pre><code>Admin.Router.map -&gt; @route 'about', path: '/' </code></pre> <p>And the about template is plain html:</p> <pre><code>&lt;h1&gt;This is ABOUT!&lt;/h1&gt; </code></pre> <p>What seems to work:</p> <ul> <li>I can see the Ember debug message, that confirms ember is working</li> <li>I have ember chrome extension installed and it can see the application template</li> </ul> <p>But, when I ask for <code>Ember.TEMPLATES</code>, I get: </p> <pre><code>Object {application: function} application: function (context, options) { __proto__: Object </code></pre> <p>and no about template there.</p> <p>Digging in the compiled js file, I can see the handlebar template is physically there:</p> <pre><code>(function() { this.HandlebarsTemplates || (this.HandlebarsTemplates = {}); this.HandlebarsTemplates["about"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) { this.compilerInfo = [4,'&gt;= 1.0.0']; helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; return "\n&lt;h1&gt;This is ABOUT!&lt;/h1&gt;\n\n"; }); return this.HandlebarsTemplates["about"]; }).call(this); </code></pre> <p>But I don't see it being explicitly added to Ember.TEMPLATES.</p> <p><strong>Update 1:</strong> Inspecting the ember-rails gem, I see that handlebars <a href="https://github.com/emberjs/ember-rails/blob/master/lib/ember/handlebars/template.rb#L51" rel="nofollow">will match only files that have <code>.raw.(hjs|...)</code>, or <code>mustache.(hjs|...)</code> in their names</a>? Documentation doesn't seem to speak about this. </p> <p>Even if I rename the template it still doesn't show and its supper weird since I haven't seen templates names like that in tutorials, or the gem documentation.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload