Это абсолютно сводит меня с ума. У меня есть модуль angular, который вводится в различные другие приложения. Когда я пытаюсь использовать templateUrl
для относительного пути в общем модуле, я получаю ошибку 404.
angular .min. js: 99 GET http://localhost : 8001 / modals / modal.html / 404 (не найдено)
Это моя структура каталогов:
order-request
|- modals
|- modal.html
|- index.js
|- InitiateTransaction.js
index. js
import * as angular from 'angular';
import InitiateTransaction from './InitiateTransaction';
export default angular
.module('orders', [])
.component('initiateTransaction', InitiateTransaction);
InitiateTransaction. js
export default {
template: `<div>
<div class="btn-group">
<div uib-dropdown is-open="status.isopen">
<button id="single-button" type="button" class="btn btn-flat btn-primary" uib-dropdown-toggle ng-disabled="disabled">
Initiate Transaction <span class="caret"></span>
</button>
<ul class="uib-dropdown-menu dropdown-menu text-left" role="menu" aria-labelledby="single-button">
<li role="menuitem"><a class="clickable" ng-click="$ctrl.open('subscription')">Subscription</a></li>
<li role="menuitem"><a class="clickable" ng-click="$ctrl.open('redemption')">Redemption</a></li>
</ul>
</div>
</div>
</div>`,
controller: class InitiateTransaction {
constructor($scope, $uibModal) {
this.$scope = $scope;
this.$uibModal = $uibModal;
this.modalInstance = null;
}
open(transactionType) {
this.modalInstance = this.$uibModal.open({
templateUrl: modals/modal.html',
size: 'lg',
scope: this.$scope
});
}
}
};
Я не использую веб-пакет и не смог импортировать html файлов в верхней части InitiateTransaction. js
Я всегда понимал, что templateUrl смотрит с уровня индексного файла для модуля? Это правильно?
Есть ли что-то, что мне нужно сделать в приложении, которое вводит это?
import '<some-working-path>/order-requests/index';
const app = angular.module('PortfolioApp', ['orders']);