[英]Ember.js and Yeoman, external template file insertion
I am a total newbie using Ember.js, I just started looking it up today. 我是一个使用Ember.js的新手,我刚刚开始查找它。 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 : 我目前正在开发使用Ember.js和Yeoman开发Phonegap应用程序,当我正在进行原型设计和调查Ember.js框架时,我想知道:
How do you use external template files in your index.html ? 如何在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 在我看过的每个教程,帖子,指南或文档中,index.html似乎都包含表单中的所有模板
<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. 但是当我使用Yeoman创建应用程序时,它会生成一个脚本/模板文件夹,其中包含所有template.handlebars
模板文件。
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 ? 我的意思是,我想,只要需要它们就应该在index.html中使用它们,但我该怎么做呢? 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. 我已按照此说明https://github.com/yeoman/yeoman/issues/455#issuecomment-8598553 ,我现在使用的是index.html中我需要的application.js。
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 ? 但是,如何告诉我的应用程序我需要在index.html中使用相关(我的路径)模板才能将其插入DOM?
I'd really like not having all my templates defined in a single .html file. 我真的不喜欢在单个.html文件中定义所有模板。
I must be missing something… 我肯定错过了什么…
Thanks ! 谢谢 !
I actually used this script : https://stackoverflow.com/a/13474886/1345058 which seems to work fine so far. 我实际上使用过这个脚本: https : //stackoverflow.com/a/13474886/1345058到目前为止似乎工作正常。
I'll probably get back on that. 我可能会重新开始。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.