(js) Automatically close sidenav on small devices

This commit is contained in:
Francis Lachapelle 2015-12-18 11:43:05 -05:00
parent 530e7a9d99
commit 80533a6f9a
2 changed files with 6 additions and 3 deletions

View file

@ -31,7 +31,7 @@
vm.editMode = false; vm.editMode = false;
AddressBook.$query.value = ''; AddressBook.$query.value = '';
// Close sidenav on small devices // Close sidenav on small devices
if ($mdMedia('sm')) if ($mdMedia('xs'))
$mdSidenav('left').close(); $mdSidenav('left').close();
$state.go('app.addressbook', {addressbookId: folder.id}); $state.go('app.addressbook', {addressbookId: folder.id});
} }

View file

@ -7,8 +7,8 @@
/** /**
* @ngInject * @ngInject
*/ */
PreferencesController.$inject = ['$q', '$window', '$state', '$mdDialog', '$mdToast', 'sgFocus', 'Dialog', 'User', 'Account', 'statePreferences', 'Authentication']; PreferencesController.$inject = ['$q', '$window', '$state', '$mdMedia', '$mdSidenav', '$mdDialog', '$mdToast', 'sgFocus', 'Dialog', 'User', 'Account', 'statePreferences', 'Authentication'];
function PreferencesController($q, $window, $state, $mdDialog, $mdToast, focus, Dialog, User, Account, statePreferences, Authentication) { function PreferencesController($q, $window, $state, $mdMedia, $mdSidenav, $mdDialog, $mdToast, focus, Dialog, User, Account, statePreferences, Authentication) {
var vm = this, account, mailboxes = []; var vm = this, account, mailboxes = [];
vm.preferences = statePreferences; vm.preferences = statePreferences;
@ -56,6 +56,9 @@
}); });
function go(module) { function go(module) {
// Close sidenav on small devices
if ($mdMedia('xs'))
$mdSidenav('left').close();
$state.go('preferences.' + module); $state.go('preferences.' + module);
} }