I am using bootstrap-angular-ui-modal for a site I am working on. The code I am using to open the modal
$modal.open(
{
templateUrl: '/home/template',
controller: myCtrl,
resolve: {
data: function () {
return data;
}
}
});
Everything is working fine. But I need to find a way to execute some code after modal is loaded. I tried different things but can't make them work. Some of things I tried
In template I did
<script>
document.onload = function () {
console.log('opened');
};
</script>
I also found there is a promise for the angular modal object named openned. I tried to
modalInstance.opened.then(function(){console.log('hello')});
not working either. I can use some help here.
This is definitely not a good solution, but at least worked for me. I just added a timeout before executing the desired function,
modalInstance.opened.then(
$timeout(function() {
console.log('hello');
}, delay));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With