samedi 20 février 2016

How to make Ember templates work with Rails? Error: `SCRIPT` tags are not allowed in HTMLBars templates

I'm trying out Ember for Rails to make a search page through this video: https://www.youtube.com/watch?v=Brn_2bbr0fE

I set up Ember using this railscast: https://www.youtube.com/watch?v=NRWMsMTY8rw

However, I get an error:

Compiler said: Error: `SCRIPT` tags are not allowed in HTMLBars templates

My application.handlebars is:

<div id="container">
<h1>App</h1>

{{render "autocomplete"}}

<script type="text/x-handlebars" data-template-name="autocomplete">
    {{input value=searchText placeholder="Search.."}}
    <ul>
        {{#each searchResuls}}
        <li>{{this}}</li>
        {{/each}}
    </ul>
</script>

I don't know how Ember templates work. Some demos have .html, .handlebars, .hbs. How do I separate data-template-name="autocomplete"? I tried putting it on a helper but it doesn't work




Aucun commentaire:

Enregistrer un commentaire