【问题标题】:Is there a way to view (through the local url) partial html templates while incorporating the main index.html?有没有办法在合并主 index.html 的同时查看(通过本地 url)部分 html 模板?
【发布时间】:2016-06-06 07:28:42
【问题描述】:

有没有办法在合并主 index.html 的同时查看(通过本地 url)部分 html 模板?

我正在尝试在本地快速访问我的部分 html 模板,这样我就可以查看它们,而无需将它们复制并粘贴到主 html 中。

我知道如何使用诸如 swig 和 Angular 之类的框架来做到这一点……但我希望有一种方法可以通过 url 访问它们,同时合并 index.html(例如添加 #包括)...

我希望工作的示例:

http://localhost:8000/#include/partials/feature.html

现在我可以去:

http://localhost:8000/partials/feature.html
  • 但 css 和 js 没有被拉入视图(在 index.html 中定义

【问题讨论】:

    标签: javascript html css url


    【解决方案1】:

    是的,我想你想要这样的东西-

    https://docs.angularjs.org/guide/templates

    【讨论】:

    • 我试图避免使用框架来实现这一点。这可能吗?
    • 我之前尝试过,我可以向您确认,这是可能的(使用 AJAX),但如果您这样做,代码将不会那么可维护。所以使用 AngularJS 是完美的。
    猜你喜欢
    • 2015-11-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-11
    • 2013-11-29
    • 1970-01-01
    • 2010-11-14
    相关资源
    最近更新 更多