1
我有這樣的代碼:
app.controller('addEmployeeCtrl', function($scope, $uibModalInstance, newEmployee){
$scope.addNewVehicle=function(){
// I want to open a new modal here
};
});
我有這樣的代碼:
app.controller('addEmployeeCtrl', function($scope, $uibModalInstance, newEmployee){
$scope.addNewVehicle=function(){
// I want to open a new modal here
};
});
你應該能夠在幾乎相同的方式來打開第二個模式,你開了第一...
注入$uibModal
服務爲addEmployeeCtrl
並撥打電話到$uibModal.open()
傳遞另一個模態配置對象。
app.controller('addEmployeeCtrl', function($scope, $uibModalInstance, $uibModal, newEmployee){
$scope.addNewVehicle = function(){
var modalInstance = $uibModal.open({
templateUrl: 'addVehicle.html',
controller: 'addVehicleCtrl',
controllerAs: 'vehicleVm'
// Any other modal config properties here
}
modalInstance.then(closedCallback, dismissedCallback);
function closedCallback(){
// Do something when the modal is closed
}
function dismissedCallback(){
// Do something when the modal is dismissed
}
};
});