2017-09-17 1 views
1

Ich habe diesen Code:

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

Antwort

1

Sie sollten eine zweite modal in der gleichen Weise öffnen können, wie Sie die erste ...

den $uibModal Dienst in addEmployeeCtrl Injizieren geöffnet und einen Anruf tätigen zu $uibModal.open() Übergabe in einem anderen modalen Konfigurationsobjekt.

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 
    } 
    }; 
}); 
Verwandte Themen