Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
135
rated 0 times [  137] [ 2]  / answers: 1 / hits: 16535  / 11 Years ago, tue, october 29, 2013, 12:00:00

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.


More From » angularjs

 Answers
27

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));

[#74647] Monday, October 28, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
alejandro

Total Points: 231
Total Questions: 102
Total Answers: 107

Location: Jordan
Member since Wed, Jun 17, 2020
4 Years ago
alejandro questions
Mon, Jul 18, 22, 00:00, 2 Years ago
Fri, Sep 18, 20, 00:00, 4 Years ago
Thu, Sep 10, 20, 00:00, 4 Years ago
;