У меня есть веб-страница с таблицей, в каждой строке таблицы есть кнопка редактирования, которая открывает модальное всплывающее окно.когда я нажимаю изменить, у меня появляются ошибки:
1- GET http://localhost:50502/Business/uib/template/modal/window.html 404 (не найдено)
2-ошибка: [$ compile: tpload] http://errors.angularjs.org/1.6.9/$compile/tpload?p0=uib%2Ftemplate%2Fmodal%2Fwindow.html&p1=404&p2=Not%20Found
, хотя я не устанавливаю шаблон для модального
BusinessView.html
<body data-ng-app="myApp">
<span id="lblReportName" class="col-xs-12 pageTitle">Business Types</span>
<div ng-controller="formCtrl">
<table id="tblBusinessTypes" class="table table-striped table-bordered nowrap display">
<thead>
<tr>
<td>
Business Type Code
</td>
<td>
Scale Length
</td>
<td>
Business Description
</td>
<td>
Event Date Alias
</td>
<td>
Options
</td>
</tr>
<tr>
<td>
<input type="text" ng-model="search.BusinessTypeCode" />
</td>
<td>
<input type="text" ng-model="search.ScaleLength" />
</td>
<td>
<input type="text" ng-model="search.BusinessDescription" />
</td>
<td>
<input type="text" ng-model="search.EventDateAlias" />
</td>
<td>
<input type="text" />
</td>
</tr>
</thead>
<tbody>
<tr ng-repeat="business in businessTypes | filter:search:allowNullValue">
<td>{{ business.BusinessTypeCode }}</td>
<td>{{ business.ScaleLength }}</td>
<td>{{ business.BusinessDescription }}</td>
<td>{{ business.EventDateAlias }}</td>
<td>
<a ng-click="editBusiness(business)" id="btnEdit">Edit</a>
</td>
</tr>
</tbody>
</table>
</div>
<script>
var app = angular.module("myApp", ["ui.bootstrap"]);
app.controller("formCtrl", function ($scope, $http, $uibModal) {
$http({
method: "GET",
url: "http://localhost:47182/api/BusinessAPI/GetBusinessTypes",
}).then(function mySuccess(response) {
debugger;
$scope.businessTypes = response.data;
}, function myError(response) {
debugger;
});
//this function to allow a null value in a filter object
$scope.allowNullValue = function (expected, actual) {
if (actual === null) {
return true;
} else {
// angular's default (non-strict) internal comparator
var text = ('' + actual).toLowerCase();
return ('' + expected).toLowerCase().indexOf(text) > -1;
}
};
$scope.editBusiness = function () {
$scope.modalInstance = $uibModal.open({
ariaLabelledBy: 'modal-title',
ariaDescribedBy: 'modal-body',
templateUrl: '/ModalTemplates/BusinessTypesModal.html',
controller :'ModelHandlerController',
controllerAs: '$ctrl',
size: 'lg',
resolve: {
}
});
};
});
app.controller("ModelHandlerController", function ($scope, $uibModalInstance) {
$scope.cancelModal = function () {
console.log("cancelmodal");
$uibModalInstance.dismiss('close');
}
$scope.ok = function () {
$uibModalInstance.close('save');
}
});
</script>
, и это модальный шаблон:
<div class="modal-header">
<h3 class="modal-title" id="modal-title">Modal Window Example</h3>
</div>
<div class="modal-body" id="modal-body">
Here Modal Body goes!!!!
</div>
<div class="modal-footer">
<button class="btn btn-primary" type="button" ng-click="ok()">Ok</button>
<button class="btn btn-warning" type="button" ng-click="cancelModal()">Cancel</button>
</div>
, и этоссылки в заголовке бизнес-файла:
<script src="/scripts/angular.min.js" ></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5/angular-animate.min.js'></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5/angular-touch.min.js"></script>
<script src='"/scripts/angular-route.js"></script>
<script src="/scripts/ui-bootstrap-tpls-0.1.0.js"></script>
<script src="/scripts/ui-bootstrap-2.5.0.min.js"></script>
<!-- Style Libraries -->
<link href="/CSS/bootstrap.min.css" rel="stylesheet" />