0
私の角型アプリケーションには、モーダルモードとモーダルモードの両方で使用できるコントローラがあります。私はどのモードであるかをチェックしたいと思います。誰か助けてくれますか?Angularjs - コントローラモーダルモードのチェック
注文コントローラ
$scope.chooseClient = function() {
$uibModal.open({
templateUrl: 'partials/client/edit.html',
controller: 'ClientEditController',
}).result.then(function (client) {
// Modal OK
if (client) {
$scope.model.client = client;
}
}, function (status) {
// Modal cancelado
});
};
クライアントコントローラ
.controller('ClientEditController',
function ($scope, $location) {
$scope.cancel = function() {
if (//I would check if modal mode) {
$scope.$dismiss('cancel');
} else {
$location.path("/client/list");
}
};
});
私は簡単な方法があるかどうかわからないが、[このドキュメント]によると(https://github.com/angular-ui/bootstrap/tree/master/src/modal/docs)、あなたの要素に 'openedClass'が適用されているかどうかを少なくとも確認できます。 –