Simple question,
I'm using Angular UI to show modals.
I have an application that opens multiple modals,
the modals has issue with the screen height and i added a code that optimize the modal size to the height of the screen.
The thing is i want to be notified when there is a new modal created so i can call my function for fixing the modal size.
Any ideas how i get notified for modal creation?
Thanks,
Examples of modal cration:
// create the modal instance and show the popup
var modalInstance = $modal.open({
templateUrl: 'partials\mymodal.html',
windowClass: "modal fade in app-modal-window",
controller: controllertest,
resolve:{
resultData:function(){ return null;}
},
backdrop: 'static',
dialogFade: true,
keyboard: false,
fade:true,
size:'lg'
});
// destroy the modal instance on cancel
var unbind_modal_popup = $scope.$on('$destroy', function ()
{
if (modalInstance != undefined)
{
modalInstance.dismiss('cancel');
}
});
// return handler.
modalInstance.result.then(function (data) {
// set the country field
unbind_modal_popup();
}, function () {
unbind_modal_popup();
})
};
Example of Modal HTML:
<div tabindex="-1" role="dialog" class="modal fade ng-isolate-scope in small-modal" ng-class="{in: animate}" ng-style="{'z-index': 1050 + index*10, display: 'block'}" ng-click="close($event)" modal-window="" window-class="modal fade in small-modal" size="sm" index="0" animate="animate">
<div class="modal-dialog modal-sm" ng-class="{'modal-sm': size == 'sm', 'modal-lg': size == 'lg'}"><div class="modal-content" modal-transclude=""><div id="parameter-modal" class="ng-scope">
<p>Text inside modal</p>
</div></div></div>
</div>