0
このPLUNKには、角度UIモーダルと閉じるボタンがあります。 Modalインスタンスにclose
メソッドがないため、ボタンが機能しません。角度UIモードで閉じるボタンが機能しない
rendered
ステートメントを削除すると、ボタンが機能します。なぜそれは動作しませんrendered
と?これが動作しない
:
var app = angular.module('app', ['ui.bootstrap']);
app.controller('myCtl', function($scope,$uibModal) {
$scope.openModal = function() {
$scope.modalInstance = $uibModal.open({
templateUrl: 'myModalContent.html',
scope: $scope
}).rendered.then(function() {
alert("modal rendered")
});
};
$scope.close = function() {
$scope.modalInstance.close();
};
})
これは、仕事をする(PLUNKを参照してください):最初のケースで
var app = angular.module('app', ['ui.bootstrap']);
app.controller('myCtl', function($scope,$uibModal) {
$scope.openModal = function() {
$scope.modalInstance = $uibModal.open({
templateUrl: 'myModalContent.html',
scope: $scope
});
};
$scope.close = function() {
$scope.modalInstance.close();
};
})