AngularUI's modal으로 작업 중이며, 모달을 닫을 때 내 컨트롤러의 변수을 변경하고 싶습니다. AngularUI의 모달을 닫았을 때 어떻게해야합니까?
<div class="modal fade" id="awesomeModal" role="dialog">
...
<button type"button" data-dismiss="modal">Close</button>
</div>
내가 모달의이
data-dismiss
함께 할 수있는
close 이벤트를 생각하지만, 나는이 특정 순간에 무언가를하는 방법을 아직 발견하지 않습니다 : 내 모달은 다음과 같습니다.
모달을 닫을 때 $scope.finished = true;
을 설정하고 싶습니다.
나는 <button type"button" data-dismiss="modal" ng-click="finished = false>Close</button>
과 같은 것을 할 수 있다는 것을 알고 있지만, 내 의견으로는 그것을 할 수있는 더 깨끗한 방법이 있습니다. 당신이 템플릿을 사용하여 모달 템플릿 인라인을주는 대신 할 수 원하는 경우, 또한
var modalInstance = $uibModal.open({
templateUrl: 'modules/alertTemplates/redirectToModal.html',
controller: 'redirectToController',
controllerAs: 'redirectToControllerVm',
keyboard: false
}
});
modalInstance.result.then(function() {
// called when you close the modal
// do your stuff
}, function() {
// called when you dismiss modal by clicking anywhere outside modal
// do your stuff
});
: 당신이 $ uibModal에 대해 물어 때문에
확인 문서'return' https://angular-ui.github.io/bootstrap/#/modal 구문은 $ modal.open ({ '이다/* params here * /}). result.then (function() {/ * logic here * /}); ' –
나는 보았지만 실제로 어떻게 대처해야할지 모르겠다. 지금까지 저는 모달을 아주 간단하게 사용했습니다. 당신이 어떻게 작동하는지 알고 계신다면, 그것에 대한 자세한 설명을 답변으로 보내 주시면 감사하겠습니다 :) – Mistalis