1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-03 13:33:32 +01:00
bitwarden-browser/src/app/directives/pageTitleDirective.js
2017-08-15 10:12:08 -04:00

22 lines
749 B
JavaScript

angular
.module('bit.directives')
.directive('pageTitle', function ($rootScope, $timeout, appSettings) {
return {
link: function (scope, element) {
var listener = function (event, toState, toParams, fromState, fromParams) {
// Default title
var title = 'bitwarden Web Vault';
if (toState.data && toState.data.pageTitle) {
title = toState.data.pageTitle + ' - ' + title;
}
$timeout(function () {
element.text(title);
});
};
$rootScope.$on('$stateChangeStart', listener);
}
};
});