Broadcast search event from action bar to filter mail-list

This commit is contained in:
Tankred Hase 2014-12-01 17:33:09 +01:00
parent 4edf79d8c4
commit e8e69ad32d
2 changed files with 15 additions and 1 deletions

View File

@ -156,6 +156,13 @@ var ActionBarCtrl = function($scope, email, dialog, statusDisplay) {
return message.checked; return message.checked;
}); });
} }
/**
* This method is called when the user changes the searchText
*/
$scope.displaySearchResults = function(searchText) {
$scope.$root.$broadcast('search', searchText);
};
}; };
module.exports = ActionBarCtrl; module.exports = ActionBarCtrl;

View File

@ -177,6 +177,13 @@ var MailListCtrl = function($scope, $timeout, $routeParams, $filter, statusDispl
Array.prototype.push.apply($scope.displayMessages, next); Array.prototype.push.apply($scope.displayMessages, next);
}; };
/**
* Handle search event in other parts of the app by filtering messages in the mail-list
*/
$scope.$on('search', function(e, query) {
$scope.displaySearchResults(query);
});
/** /**
* This method is called when the user changes the searchText * This method is called when the user changes the searchText
*/ */