(js) Scroll to previously selected message

This commit is contained in:
Francis Lachapelle 2016-01-18 14:33:31 -05:00
parent 691ab3ff27
commit 3787296fd6

View file

@ -6,8 +6,8 @@
/** /**
* @ngInject * @ngInject
*/ */
MailboxController.$inject = ['$window', '$state', '$mdDialog', 'stateAccounts', 'stateAccount', 'stateMailbox', 'encodeUriFilter', 'Dialog', 'Account', 'Mailbox']; MailboxController.$inject = ['$window', '$timeout', '$state', '$mdDialog', 'stateAccounts', 'stateAccount', 'stateMailbox', 'encodeUriFilter', 'Dialog', 'Account', 'Mailbox'];
function MailboxController($window, $state, $mdDialog, stateAccounts, stateAccount, stateMailbox, encodeUriFilter, Dialog, Account, Mailbox) { function MailboxController($window, $timeout, $state, $mdDialog, stateAccounts, stateAccount, stateMailbox, encodeUriFilter, Dialog, Account, Mailbox) {
var vm = this, messageDialog = null; var vm = this, messageDialog = null;
// Expose controller // Expose controller
@ -163,7 +163,13 @@
function cancelSearch() { function cancelSearch() {
vm.mode.search = false; vm.mode.search = false;
vm.selectedFolder.$filter(); vm.selectedFolder.$filter().then(function() {
if (vm.selectedFolder.selectedMessage) {
$timeout(function() {
vm.selectedFolder.$topIndex = vm.selectedFolder.uidsMap[vm.selectedFolder.selectedMessage];
});
}
});
} }
function newMessage($event) { function newMessage($event) {