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 用C语言输入方程怎么
    • ¥15 网站显示不安全连接问题
    • ¥15 github训练的模型参数无法下载
    • ¥15 51单片机显示器问题
    • ¥20 关于#qt#的问题:Qt代码的移植问题
    • ¥50 求图像处理的matlab方案
    • ¥50 winform中使用edge的Kiosk模式
    • ¥15 关于#python#的问题:功能监听网页
    • ¥15 怎么让wx群机器人发送音乐
    • ¥15 fesafe材料库问题