I am using Angularjs UI bootstrap
to render Modal windows in my project. But In some situation I want to call a function after the modal loads. I have tried with $timeout
and $viewContentLoaded
but no use. can any one help me to resolve this issue.
Thank you all.
I go through the documentation of angular ui bootstrap and finally I found the solution.
The open
method returns a modal instance
, an object with the opened
propertie:
opened
- a promise
that is resolved when a modal gets opened after downloading content's template and resolving all variables
to call function after model opens.
$modalInstance.opened.then(function(){
alert('hi');
});
Alternatively, you can use:
$modalInstance.rendered.then(function(){
alert('hi');
});
PS: this was originally pointed by @esqew user. I put it here just to be easier to find.
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