<i id='A1QDi'><tr id='A1QDi'><dt id='A1QDi'><q id='A1QDi'><span id='A1QDi'><b id='A1QDi'><form id='A1QDi'><ins id='A1QDi'></ins><ul id='A1QDi'></ul><sub id='A1QDi'></sub></form><legend id='A1QDi'></legend><bdo id='A1QDi'><pre id='A1QDi'><center id='A1QDi'></center></pre></bdo></b><th id='A1QDi'></th></span></q></dt></tr></i><div id='A1QDi'><tfoot id='A1QDi'></tfoot><dl id='A1QDi'><fieldset id='A1QDi'></fieldset></dl></div>

    <small id='A1QDi'></small><noframes id='A1QDi'>

  • <tfoot id='A1QDi'></tfoot>
    • <bdo id='A1QDi'></bdo><ul id='A1QDi'></ul>

      <legend id='A1QDi'><style id='A1QDi'><dir id='A1QDi'><q id='A1QDi'></q></dir></style></legend>
      1. 使用包含外部文件的文件夹制作网页

        时间:2023-10-21
              1. <small id='TQqX9'></small><noframes id='TQqX9'>

                • <bdo id='TQqX9'></bdo><ul id='TQqX9'></ul>

                  <legend id='TQqX9'><style id='TQqX9'><dir id='TQqX9'><q id='TQqX9'></q></dir></style></legend>

                  <tfoot id='TQqX9'></tfoot>
                    <tbody id='TQqX9'></tbody>

                  <i id='TQqX9'><tr id='TQqX9'><dt id='TQqX9'><q id='TQqX9'><span id='TQqX9'><b id='TQqX9'><form id='TQqX9'><ins id='TQqX9'></ins><ul id='TQqX9'></ul><sub id='TQqX9'></sub></form><legend id='TQqX9'></legend><bdo id='TQqX9'><pre id='TQqX9'><center id='TQqX9'></center></pre></bdo></b><th id='TQqX9'></th></span></q></dt></tr></i><div id='TQqX9'><tfoot id='TQqX9'></tfoot><dl id='TQqX9'><fieldset id='TQqX9'></fieldset></dl></div>

                  本文介绍了使用包含外部文件的文件夹制作网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  以前,我使用 $sce.trustAsHtml(aString) 来注入字符串 (例如,<html>...</html>) 到模板 <div ng-bind-html="content"></div> 在加载生成的 URL 时显示图表:

                  Previously, I used $sce.trustAsHtml(aString) to inject a string (eg, <html>...</html>) to a template <div ng-bind-html="content"></div> to display a graph when loading a generated URL:

                  .state('urls', {
                      url: '/urls/{id}',
                      template: '<div ng-bind-html="content"></div>',
                      controller: 'UrlCtrl',
                      resolve: {
                          url: ['$stateParams', 'urls', function ($stateParams, urls) {
                              return urls.get($stateParams.id);
                          }]
                      }
                  })
                  
                  app.controller('UrlCtrl', ['$sce', '$scope', 'url', function($sce, $scope, url) {
                      $scope.content = $sce.trustAsHtml(url.content);
                  }]);
                  

                  现在,用于生成图形的 html 包含对其他文件的引用,例如 <script src="script.js"></script>.所以我需要一个文件文件夹(.html.css.js)来绘制图表.我可以将整个文件夹放在我的服务器中,但问题是如何将这些文件注入到模板中.

                  Now, the html to generate a graph contains references to other files, eg, <script src="script.js"></script>. So I need a folder of files (.html, .css, .js) to draw a graph. I can put the whole folder in my server, but the problem is how to inject these files to the template.

                  我试过 templateUrl: 'http://localhost:3000/tmp/ZPBSytN5GpOwQN51AAAD/index.html',加载 localhost:3000/#/urls/58b8c55b5d18ed6163324fb4浏览器确实加载了 html 页面.但是,script.js 未加载,控制台日志中显示错误 Failed to load resource: the server respond with a status of 404 (Not Found).

                  I tried templateUrl: 'http://localhost:3000/tmp/ZPBSytN5GpOwQN51AAAD/index.html', loading localhost:3000/#/urls/58b8c55b5d18ed6163324fb4 in the browser does load the html page. However, script.js is NOT loaded, an error Failed to load resource: the server responded with a status of 404 (Not Found) is shown in the console log.

                  有人知道怎么修改吗?

                  否则,是否有任何其他方式可以说类似 src=http://localhost:3000/tmp/ZPBSytN5GpOwQN51AAAD/index.html (例如在 iframe 中)?那么,index.html中的<script src="script.js"></script>就会知道它指的是script.js 在同一个文件夹中.

                  Otherwise, is there any other ways to say something like src=http://localhost:3000/tmp/ZPBSytN5GpOwQN51AAAD/index.html (like in iframe)? Then, <script src="script.js"></script> in index.html will know it refers to the script.js in the same folder.

                  根据@Icycool的评论,我改成了templateUrl: '/htmls/test.html',和test.html 包含 <div ng-include="'http://localhost:3000/tmp/ZPBSytN5GpOwQN51AAAD/index.html'"></div>.测试表明它确实加载了 test.htmlindex.html,但没有加载 script.js:GET http://localhost:3000/script.js?_=1488543470023 404(未找到).

                  Edit 1: Following the comment of @Icycool , I changed to templateUrl: '/htmls/test.html', and test.html contains <div ng-include="'http://localhost:3000/tmp/ZPBSytN5GpOwQN51AAAD/index.html'"></div>. The test showed it did load test.html and index.html, but NOT script.js: GET http://localhost:3000/script.js?_=1488543470023 404 (Not Found).

                  编辑 2: 我创建了两个文件用于测试目的:index.html 和 script.js.这是一个plunker,既不是模板 也不是 templateUrl 工作,如解释...

                  Edit 2: I have created two files for test purpose: index.html and script.js. Here is a plunker, neither template nor templateUrl works, as explained...

                  推荐答案

                  如果您愿意,可以使用 .

                  You may use <object> if you prefer.

                  <object type="text/html" data="https://www.matrixlead.com/tmp/index.html"></object>
                  

                  查看更新的插件这里.

                  这篇关于使用包含外部文件的文件夹制作网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                    <bdo id='zHVxH'></bdo><ul id='zHVxH'></ul>

                    <small id='zHVxH'></small><noframes id='zHVxH'>

                      <tbody id='zHVxH'></tbody>
                    <tfoot id='zHVxH'></tfoot>
                    <legend id='zHVxH'><style id='zHVxH'><dir id='zHVxH'><q id='zHVxH'></q></dir></style></legend>

                          1. <i id='zHVxH'><tr id='zHVxH'><dt id='zHVxH'><q id='zHVxH'><span id='zHVxH'><b id='zHVxH'><form id='zHVxH'><ins id='zHVxH'></ins><ul id='zHVxH'></ul><sub id='zHVxH'></sub></form><legend id='zHVxH'></legend><bdo id='zHVxH'><pre id='zHVxH'><center id='zHVxH'></center></pre></bdo></b><th id='zHVxH'></th></span></q></dt></tr></i><div id='zHVxH'><tfoot id='zHVxH'></tfoot><dl id='zHVxH'><fieldset id='zHVxH'></fieldset></dl></div>