0
如果我在我的ui-bootstrap模式主體中使用選擇標記(下拉列表),則它不顯示模式頁腳按鈕。如果我使用輸入元素而不是選擇標籤,它工作正常。在ui-bootstrap模型中選擇了標記不會顯示頁腳按鈕
我試過所有的東西,無法解決這個問題。可能會有一些缺失的東西。
var app = angular.module('myApp', ['ngAnimate','ui.bootstrap']);
app.controller('shell', function($scope, $interval, $uibModal) {
$scope.test = 'hello world';
this.counter = 0;
var vm = this;
this.moveHandler = function() {
console.log('mouse moved, reset counter!');
vm.counter = 0;
};
var timer = function(iterCount) {
console.log('timer tick', vm.counter);
vm.counter++;
};
var intervalPromise = $interval(timer, 100);
$scope.$on("$destroy", function handler() {
// destruction code here
$interval.cancel(intervalPromise); // stop interval on destroy of ctrl.
});
$scope.items = ['item1', 'item2', 'item3'];
$scope.open = function (size) {
var modalInstance = $uibModal.open({
templateUrl: 'myModalContent.html',
controller: 'ModalInstanceCtrl',
size: size,
resolve: {
items: function() {
return $scope.items;
}
}
});
};
});
// modal code from angular-ui-bootstrap demo
app.controller('ModalDemoCtrl', function ($scope, $uibModal, $log) {
$scope.items = ['item1', 'item2', 'item3'];
$scope.open = function (size) {
var modalInstance = $uibModal.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());
});
};
});
// Please note that $modalInstance represents a modal window (instance) dependency.
// It is not the same as the $modal service used above.
app.controller('ModalInstanceCtrl', function ($scope, $uibModalInstance, items) {
$scope.items = items;
$scope.selected = {
item: $scope.items[0]
};
$scope.ok = function() {
$uibModalInstance.close($scope.selected.item);
};
$scope.cancel = function() {
$uibModalInstance.dismiss('cancel');
};
});
html, body {
width: 100%;
height: 100%;
}
/*
.modal {
display: block;
}*/
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.7/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-animate.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/1.3.0/ui-bootstrap-tpls.js"></script>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"/>
\t <div ng-controller="ModalDemoCtrl">
\t \t <script type="text/ng-template" id="myModalContent.html">
\t \t \t <div class="modal-header">
\t \t \t \t <h3 class="modal-title">I'm a modal!</h3>
\t \t \t </div>
\t \t \t <div class="modal-body">
\t \t \t \t \t \t
\t \t \t \t \t \t \t <!-- <input type="text" class="form-control"/> -->
<select class="form-control"/>
\t \t \t \t \t \t
\t \t \t </div>
\t \t \t <div class="modal-footer">
\t \t \t \t <button class="btn btn-primary" ng-click="ok()">OK</button>
\t \t \t \t <button class="btn btn-warning" ng-click="cancel()">Cancel</button>
\t \t \t </div>
\t \t </script>
\t \t <button class="btn btn-default" ng-click="open()">Open me!</button>
\t \t <button class="btn btn-default" ng-click="open('lg')">Large modal</button>
\t \t <button class="btn btn-default" ng-click="open('sm')">Small modal</button>
\t \t <div ng-show="selected">Selection from a modal: {{ selected }}</div>
\t {{test}}
\t </div>
您還沒有關閉''' – Sn0opr