无法加载模板:uib/template/modal/window.html [英] Failed to load template: uib/template/modal/window.html

查看:198
本文介绍了无法加载模板:uib/template/modal/window.html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我觉得我已经尝试了一切,但仍然收到错误消息:

I feel like i have attempted everything and i still get the error:

无法加载模板:uib/template/modal/window.html

Failed to load template: uib/template/modal/window.html

在我的索引文件中,我添加了以下内容:

in my index file i have added the following:

<script src="node_modules/angular-ui-bootstrap/dist/ui-bootstrap.js"></script>
<script src="node_modules/angular-ui-bootstrap/dist/ui-bootstrap-tpls.js"></script>

在我的应用程序文件ive中添加了

in my app file ive added:

    'ui.bootstrap', 

在我的控制器文件ive中添加了以下内容:

And in my controller file ive added the following:

$uibModal

this.openPayment = function () {
    var modalInstance = $uibModal.open({
        ariaLabelledBy: 'modal-title',
        ariaDescribedBy: 'modal-body',
        templateUrl: 'payment.html',
        controller: 'paymentController',
        controllerAs: '$ctrl',
        size: 'lg',
    });
}

在我的paymentController中,我添加了以下内容:

in my paymentController i have added the following:

angular.module('Payment').controller('paymentController', function ($uibModalInstance) {
    var ctrl = this;
});

payment.html:

    <div class="modal-header">
    <h3 class="modal-title" translate="ACADEMY.EDIT.COURSES.CREATE"></h3>
</div>
<div class="modal-body">
</div>
<div class="lb-modal-footer">
    <a class="btn btn-grey" tooltip="{{ 'TOOLTIP.CANCEL' | translate }}" ng-click="CTRL.cancel()"><i
            class="fa fa-ban"></i></a>
    <button class="btn btn-success m-l-xs {{CTRL.academyCourse.course ? '':'disabled'}}" tooltip="{{ 'TOOLTIP.SAVE_AND_EXIT' | translate }}" ng-click="CTRL.addCourse()"><i
            class="fa fa-check-square-o"></i></button>
</div>

那么有人能告诉我我做错了什么吗?

So can anyone tell me what ive done wrong?

推荐答案

  1. 请确保您已附加了ui-bootstrap的模板版本,或未附加的模板版本.

  1. Make sure you have either attached the template version of ui-bootstrap or the one without.

<!-- remove this -->
<!--<script src="node_modules/angular-ui-bootstrap/dist/ui-bootstrap.js"></script>--> 
<script src="node_modules/angular-ui-bootstrap/dist/ui-bootstrap-tpls.js"></script>

在您的情况下,您缺少模态模板(uib/template/modal/window.html),所以我会保留ui-bootstrap-tpls.js.

In your case, you're missing the modal template (uib/template/modal/window.html), so I would keep the ui-bootstrap-tpls.js.

  1. 确保您已正确链接到脚本,转到页面源并尝试访问uib脚本.您可能已经构建了项目,但未将脚本文件添加到构建中.

  1. Make sure you are properly linking to the script, go to the page source and try reaching the uib script, It's possible you have built your project but the script file wasn't added into the build.

确保在添加角度脚本后添加uib脚本,并在index.html中将引导文件添加后

make sure you are adding the uib script after you add the angular script and after you add the bootstrap files in your index.html

这篇关于无法加载模板:uib/template/modal/window.html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆