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

It seems to me that I tried everything, and I still get the error:

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

in my index file I 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> 

in my ive application file added:

  'ui.bootstrap', 

And in my ive controller file the following is added:

 $uibModal 

and

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

in my paymentController I added the following:

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

And 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 ml-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 someone tell me what I did wrong?

+6
source share
2 answers
  • Make sure you either attached the version of the ui-bootstrap template, or without it.

     <!-- 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> 

In your case, you are missing a modal template ( uib/template/modal/window.html ), so I would save ui-bootstrap-tpls.js .

  1. Make sure you are attached to the script correctly, go to the page source and try to reach the uib script. You may have created your project, but the script file has not been added to the assembly.

  2. make sure you add uib script after , you add angular script and after , add bootstrap files to your .html index

+15
source

I solve this program by buying the removal of the link to ui-bootstrap.js, using the link only to ui-bootstrap-tpls.js, everything fixed.

+1
source

Source: https://habr.com/ru/post/1013058/


All Articles