http://angular-ui.github.io/bootstrap에 제공된 모달 예제를 시도하고 있습니다. 작업 버튼을 클릭하면 일부 창이 튀어 나온 것처럼 화면이 흐려 지지만 거기에 아무것도 표시되지 않고 모달을 열 때 콘솔에 이렇게 말합니다.
리소스로드 실패 : 서버가 상태 404 (찾을 수 없음)로 응답했습니다. --- Cannot GET /function%20(a,b)%7Breturn%20b.templateUrl%7C%7C%22template/modal/window.html%22 % 7D Uncaught TypeError : undefined는 함수가 아닙니다 --- angular.min.js
내 컨트롤러
'use strict'
var LoginCtrl = ['$scope', '$modal', '$log', function($scope, $modal, $log) {
$scope.items = ['item1', 'item2', 'item3'];
$scope.open = function (size) {
var modalInstance = $modal.open({
templateUrl: 'myModalContent.html',
controller: 'ModalInstanceCtrl',
size: size,
resolve: {
items: function () {
return $scope.items;
}
}
});
modalInstance.result.then(function (selectedItem) {
$scope.selected = selectedItem;
}, function () {
$log.info('Modal dismissed at: ' + new Date());
});
};
}];
var ModalInstanceCtrl = ['$scope', '$modalInstance', 'items', function($scope, $modalInstance, items){
$scope.items = items;
$scope.selected = {
item: $scope.items[0]
};
$scope.ok = function () {
$modalInstance.close($scope.selected.item);
};
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
}];
내 템플릿
<div>
<script type="text/ng-template" id="myModalContent.html">
<div>
<h3 class="modal-title">I m a modal</h3>
</div>
<div>
<ul>
<li ng-repeat="item in items">
<a ng-click="selected.item = item">{{ item }}</a>
</li>
</ul>
Selected: <b>{{ selected.item }}</b>
</div>
<div>
<button ng-click="ok()">OK</button>
<button ng-click="cancel()">Cancel</button>
</div>
</script>
<button ng-click="open()">Open me!</button>
<button ng-click="open('lg')">Large modal</button>
<button ng-click="open('sm')">Small modal</button>
<div ng-show="selected">Selection from a modal: {{ selected }}</div>
</div>
이 이상한 오류가 표시되는 이유입니다. 버전 0.11.2의 ui-bootstrap-tpls.min.js와 버전 1.3.1의 angular.min.js를로드하고 있습니다. 나는 여기 에서 같은 종류의 문제 를 언급했으며 그중 하나가 말한 것처럼 업데이트 된 버전도 있습니다. 어떤 제안이라도 큰 도움이 될 것입니다.
좋아, 이것은 일부 로딩 순서 / 다른 버전 또는 종속성 혼합-문제처럼 보입니다.
그러나 밝혀진대로이 버전의 부트 스트랩에서는 잘 작동하지 않는 앵귤러 버전 (1.1.3)입니다.
그래서 일단, 여기에 각 1.2.25와 코드의 작업 버전 (주요 부분)입니다.
또한 angular의 index.html, 버전 1.1.3 (현재 표시되어 있음)에도 포함되었습니다. 두 버전을 교체하면 오류가 재현됩니다.
<!-- <script src="https://code.angularjs.org/1.1.3/angular.min.js"></script> -->
특정 오류에 관계없이 angular를 버전 1.3 (또는 IE8 지원이 필수 인 경우 1.2.25)으로 업그레이드하는 것이 좋습니다. 훨씬 빠르며 훨씬 더 멋진 기능을 포함하며 많은 EMCA5 및 HTML5 / CSS3 기능을 활용합니다.
업그레이드 할 수 없습니까? 지금은 디버깅 시간입니다. 무엇이 잘못되었는지 알 수 없습니다. "그냥"이유를 찾아야합니다.
행운을 빕니다!
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다