This repository has been archived by the owner on Sep 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Sidenav : Is there a way to call a callback on escape or backdrop close ? #3179
Labels
Comments
+1 |
👍 I need to save changes when the sidenav is closed and I don't see any way of doing that? Currently i'm using |
Here is the workaround we use for now: You can use #974 and bind a function to your sidenav component in your controller this.isOpen = function() { return false };
// Register bindnig function
$mdComponentRegistry
.when("yoursidenav")
.then( (sideNav)=>{
this.isOpen = angular.bind(sideNav, sideNav.isOpen );
}); And then add a watch on this function: $scope.$watch("myController.isOpen()",(newValue,oldValue)=>{
// save your changes here
},true); |
Thanks for the workaround @sylviefiat! |
+1 |
EladBezalel
added a commit
that referenced
this issue
Dec 2, 2015
Added onClose callback to handle close, backdrop click or escape key pressed fixes #3179
Or $scope.$watch(
function() { return $mdSidenav('yourSide').isOpen(); },
function(newValue, oldValue) {
console.log(newValue);
}
); |
EladBezalel
added a commit
that referenced
this issue
Jan 29, 2016
Added onClose callback to handle close, backdrop click or escape key pressed fixes #3179
+1 |
@EladBezalel Hi any update on this one ? |
@mfilotto waiting for merge .. :) |
EladBezalel
added a commit
that referenced
this issue
Feb 26, 2016
Added onClose callback to handle close, backdrop click or escape key pressed fixes #3179
ThomasBurleson
added
has: Pull Request
A PR has been created to address this issue
and removed
pr: merge ready
This PR is ready for a caretaker to review
labels
Apr 21, 2016
+1 |
EladBezalel
added a commit
that referenced
this issue
Jun 20, 2016
Added onClose callback to handle close, backdrop click or escape key pressed fixes #3179
toshiakiezaki
pushed a commit
to toshiakiezaki/angular-material
that referenced
this issue
Jul 1, 2016
Added onClose callback to handle close, backdrop click or escape key pressed fixes angular#3179 Closes angular#5974
Was just wondering, how can we use this fix when we want to capture whenever we click on backdrop or press esc key. I know how to use the $scope.$watch but still feel like using this fix somehow for the project. (y) |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Hi,
I have an ui-view in my sidenav and I'd like to reset the router path when the user click outside the sidenav (on the backdrop) or press escape.
Is there a way to do so ?
Thanks for your help
The text was updated successfully, but these errors were encountered: