2017-09-17 60 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 
    } 
    }; 
}); 
相关问题