简体   繁体   中英

Ember.js and Yeoman, external template file insertion

I am a total newbie using Ember.js, I just started looking it up today. I am currently projecting to develop a Phonegap app using Ember.js and Yeoman, and as I was prototyping and investigating the Ember.js framework, I was wondering :

How do you use external template files in your index.html ? In every tutorial, post, guide or documentation piece I have seen, the index.html seems ton contain all the templates, in the form

<script data-template-name="my_template_name" type="text/x-handlebars">
{{my_handlebar_variable_content}}
</script>

and such…

But when I create an application with Yeoman, it generates a scripts/template folder, containing all the template.handlebars template files.

How do I use them ? I mean, I guess, they should be required in the index.html whenever they are needed, but how do I do that ? I have followed this instructions https://github.com/yeoman/yeoman/issues/455#issuecomment-8598553 and I am now with a application.js that I have required in my index.html.

But how do I tell my application that I need to require the relevant (to my route) template in my index.html for it to be inserted in the DOM ?

I'd really like not having all my templates defined in a single .html file.

I must be missing something…

Thanks !

I actually used this script : https://stackoverflow.com/a/13474886/1345058 which seems to work fine so far.

I'll probably get back on that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM