【发布时间】:2016-11-23 16:14:35
【问题描述】:
您好,我正在使用带有角度 UI 的 webapi SPA 应用程序。我正在使用下面的 templateurl 加载一个 html 页面
$uibModal.open({
templateUrl: '/PURNATEST/App/Reports/ABC/ReportEditModel.html',
controller: 'ABCDController',
scope: $scope
}).result.then(function ($scope) {
clearSearch();
}, function () {
var stest = "";
});
我收到以下错误: angular.js:13550 错误:[$compile:tpload] 无法加载模板:/PURNATEST/App/Reports/ABC/ReportEditModel.html(HTTP 状态:404 未找到)
在 BundleConfig 中,我同时注册了 bootstrap 和 bootstrap-tpl
"~/Scripts/angular-ui/ui-bootstrap.js",// used
"~/Scripts/angular-ui/ui-bootstrap-tpls.js", //used
我的模块看起来像这样
var PCMApp = angular.module('PCMApp', [
'ngRoute', //app route (url path) support
'ngSanitize', //fixes HTML issues in data binding
'ui.bootstrap',
'ngDialog',
'common'
]);
谁能告诉我如何解决这个问题?
【问题讨论】:
-
错误提示
404找不到文件,您确定该文件确实存在于/PURNATEST/App/Reports/ABC/ReportEditModel.html这个位置吗? -
是的,Pankaj,我交叉验证了。它存在。
-
确保你给
templateUrl提供正确的路径。 -
我也尝试提供完整的网址(绝对网址)。但没有运气。
标签: angularjs