Angularjs 角度ui引导无法呈现模式
我正在尝试使用带有以下模式代码的Angularjs 角度ui引导无法呈现模式,angularjs,angular-ui-bootstrap,bootstrap-modal,Angularjs,Angular Ui Bootstrap,Bootstrap Modal,我正在尝试使用带有以下模式代码的$ui.bootstrap创建自定义模式: var modalInstance = $uibModal.open({ animation: true, templateUrl: '../partials/modal/modalTemplate.html', controller: ['$scope', '$uibModalInstance', function ($scope, $uibModalInstan
$ui.bootstrap
创建自定义模式
:
var modalInstance = $uibModal.open({
animation: true,
templateUrl: '../partials/modal/modalTemplate.html',
controller: ['$scope', '$uibModalInstance', function ($scope, $uibModalInstance) {
$scope.hello = "hii!";
$scope.ok = function () {
$uibModalInstance.close();
};
$scope.cancel = function () {
$uibModalInstance.dismiss('cancel');
};
}],
resolve: {
items: function () {
return $scope.items;
}
}
});
这是模态模板:
<script type="text/ng-template">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title">Please wait</h3>
</div>
<div class="modal-body">
<!--loader-->
<div class="loader" ng-show="showLoader"></div>
<h2>{{hello}}</h2>
</div>
<div class="modal-footer">
<h3>footer</h3>
</div>
</div>
</div>
</script>
当我只使用模板
(不模板URL
)关键字时,没有错误和某种形式的模式呈现,但除了作为文本指向模板URL
的路径外,它没有任何内容。这让我发疯,我读遍了stackoverflow,似乎每个人都有不同的解决方案,但没有一个有效。请告知
忘了提及,我正在使用uibootstrap的tpls
版本,如下所示:
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/2.3.2/ui-bootstrap-tpls.js"></script>
模态模板不应该有此“脚本”标记没有任何区别,仍然相同404
错误:\n路径应该是相对于js
文件的还是绝对路径?检查modalTemplate.html的位置,它是您在templateUrl中使用的正确位置吗?尝试此templateUrl:“templates/partials/modal/modalTemplate.html”没关系,我帮了你,这对我来说已经足够了。
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/2.3.2/ui-bootstrap-tpls.js"></script>
templates->login (contains the js file that should render the modal)
templates->partials->modal->modalTemplate.html (the template itself)