douye6812 2018-02-27 19:28
浏览 46

在<script src =“”>标记中包含把手模板

Creating a tabulated page with many "partial views" which are just each handlebars template wrapped in <script> tags. The page is getting a little busy, so I'd like all my templates to live in a folder in web called templates and just include them. The problem is that the template doesn't load on the page when i try to include it but work fine when I put the template right in the script tags.

Here is the script include I'm using:

<script id="referral-summary-template" type="text/x-handlebars-template" src="/templates/referrals/referralSummaryTemplate.hbs"></script>

For reference I tried changing the handlebars file to a js file that just alerted "hello", and that worked fine. Am I just misunderstading what can be a src tag...as in I can only reference JS files?

referralSummaryTemplate.hbs Just contains the template (html with handlebars templating). I need the template to be in script tags so I can Handlebars.complie() on click events without having to async get the template.

Thanks.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 请问我该如何添加自己的数据去运行蚁群算法代码
    • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”
    • ¥15 网络设备配置与管理这个该怎么弄
    • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
    • ¥20 西门子S7-Graph,S7-300,梯形图
    • ¥50 用易语言http 访问不了网页
    • ¥50 safari浏览器fetch提交数据后数据丢失问题
    • ¥15 matlab不知道怎么改,求解答!!
    • ¥15 永磁直线电机的电流环pi调不出来
    • ¥15 用stata实现聚类的代码