【问题标题】:Failed to load template: uib/template/modal/window.html (HTTP status 404 Not Found)无法加载模板:uib/template/modal/window.html(HTTP 状态 404 Not Found)
【发布时间】:2017-09-26 13:26:12
【问题描述】:

我已将 ui-bootstrap 添加到 Angular 1.x 项目中,当我想打开模态表单时出现此错误

[$compile:tpload] 加载模板失败:uib/template/modal/window.html(HTTP 状态:404 Not Found)

我之前使用过 ui-bootstrap 并且一直运行良好,但在我的新项目中我遇到了问题。

代码如下:

$uibModal.open(
{ backdrop: 'static', templateUrl: 'DesktopModules/' + 
  window.GLOB.moduleFolderName + '/app/form/form.html',
  controller: 'requestCtrl',
  size: 'sm',
  scope: $scope 
 });

角度版本:v1.5.8

UIBS:v2.2.0

引导程序:v3.3.7

【问题讨论】:

    标签: javascript angularjs angular-ui-bootstrap


    【解决方案1】:

    我们已经解决了这个问题, 我们用了 $templateCache.removeAll(); 总是有一个新版本的文件而不是缓存的文件,这个功能会干扰加载 ui 引导程序的模板文件。

    【讨论】:

      【解决方案2】:

      您缺少模态模板uib/template/modal/window.html

      确保你加载了ui-bootstrap-tpls.js

      tpls 标签表示文件包含模板。


      供参考:

      ui-bootstrap-tpls.js

      angular.module("ui.bootstrap"
       ["ui.bootstrap.tpls"
       "ui.bootstrap.transition"
      "ui.bootstrap.collapse"
      "ui.bootstrap.accordion"
      "ui.bootstrap.alert"
      "ui.bootstrap.bindHtml"
      "ui.bootstrap.buttons"
      "ui.bootstrap.carousel"
      "ui.bootstrap.position"
      "ui.bootstrap.datepicker"
      "ui.bootstrap.dropdownToggle"
      "ui.bootstrap.modal"
      "ui.bootstrap.pagination"
      "ui.bootstrap.tooltip"
      "ui.bootstrap.popover"
      "ui.bootstrap.progressbar"
      "ui.bootstrap.rating"
      "ui.bootstrap.tabs"
      "ui.bootstrap.timepicker"
      "ui.bootstrap.typeahead"]);
      
      angular.module("ui.bootstrap.tpls"
       ["template/accordion/accordion-group.html"
      "template/accordion/accordion.html"
      "template/alert/alert.html"
      "template/carousel/carousel.html"
      "template/carousel/slide.html"
      "template/datepicker/datepicker.html"
      "template/datepicker/popup.html"
      "template/modal/backdrop.html"
      "template/modal/window.html"   //     < ---- Your case
      "template/pagination/pager.html"
      "template/pagination/pagination.html"
      "template/tooltip/tooltip-html-unsafe-popup.html"
      "template/tooltip/tooltip-popup.html"
      "template/popover/popover.html"
      "template/progressbar/bar.html"
      "template/progressbar/progress.html"
      "template/rating/rating.html"
      "template/tabs/tab.html"
      "template/tabs/tabset-titles.html"
      "template/tabs/tabset.html"
      "template/timepicker/timepicker.html"
      "template/typeahead/typeahead-match.html"
      "template/typeahead/typeahead-popup.html"]);
      angular.module('ui.bootstrap.transition'
       [])
      

      【讨论】:

      • 我已经添加了提到的文件,但问题是别的。
      • @MahyarPasarzangene 你找到问题了吗?你是怎么添加文件的?
      猜你喜欢
      • 2017-04-26
      • 1970-01-01
      • 2014-11-29
      • 2017-09-27
      • 2019-03-24
      • 2017-01-12
      • 1970-01-01
      • 2016-07-01
      • 1970-01-01
      相关资源
      最近更新 更多