2017-09-17 28 views
1

我有這樣的代碼:

app.controller('addEmployeeCtrl', function($scope, $uibModalInstance, newEmployee){ 
    $scope.addNewVehicle=function(){ 
    // I want to open a new modal here 
    };  
}); 

回答

1

你應該能夠在幾乎相同的方式來打開第二個模式,你開了第一...

注入$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 
    } 
    }; 
}); 
相關問題