This repository has been archived by the owner on May 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(dialog): close dialog on location change
Closes #335
- Loading branch information
1 parent
74beecd
commit 474ce52
Showing
3 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,6 +93,11 @@ dialogModule.provider("$dialog", function(){ | |
e.preventDefault(); | ||
self.$scope.$apply(); | ||
}; | ||
|
||
this.handleLocationChange = function() { | ||
self.close(); | ||
self.$scope.$apply(); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
pkozlowski-opensource
Member
|
||
}; | ||
} | ||
|
||
// The `isOpen()` method returns wether the dialog is currently visible. | ||
|
@@ -184,6 +189,8 @@ dialogModule.provider("$dialog", function(){ | |
Dialog.prototype._bindEvents = function() { | ||
if(this.options.keyboard){ body.bind('keydown', this.handledEscapeKey); } | ||
if(this.options.backdrop && this.options.backdropClick){ this.backdropEl.bind('click', this.handleBackDropClick); } | ||
|
||
this.$scope.$on('$locationChangeSuccess', this.handleLocationChange); | ||
}; | ||
|
||
Dialog.prototype._unbindEvents = function() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$digest is already in progress since we operate inside angular, so $apply isn't necessary.