Listening for $modal events ('open','close')
I'm using the modal directive, can't seem to figure out how to listen to events, is this possible? I'm opening a modal using the directive, not service and assigning to a controller.
Thank you!
Since event bubble up, you just have to use:
$scope.$on('modal-shown', function() {});
in one of the parent controllers.
This still works? Can you help me with this plunk?
http://plnkr.co/mDpWyiJAQdeU0vTfEzWg
thanks in advance!
This doesn't seem to be working anymore, if ever. I'm listening on the parent scope, but the event modal-shown or modal-hidden is never called.
As with @eranimo, it looks to me like it's not working anymore; does anyone know if the event is still being fired, or if there's an alternative way to watch for a modal being closed?
You can use it like this: $scope.$on('modal.hide',function(){ console.log("hide"); }); $scope.$on('modal.show',function(){ console.log("show"); });
there's more details in the source, basically look for any emits ->
https://github.com/mgcrea/angular-strap/blob/master/src/modal/modal.js
note there seems to be a bug in the aside code where it emits with modal prefixs, just in case your trying to get aside events
$scope.$on('modal.shown', function() {}); is ok!!
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.