mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-01-23 23:59:17 +01:00
33 lines
886 B
JavaScript
33 lines
886 B
JavaScript
(function () {
|
|
'use strict';
|
|
|
|
angular.module('core')
|
|
.directive('pageTitle', pageTitle);
|
|
|
|
pageTitle.$inject = ['$rootScope', '$interpolate', '$state', '$translate'];
|
|
|
|
function pageTitle($rootScope, $interpolate, $state, $translate) {
|
|
var directive = {
|
|
restrict: 'A',
|
|
link: link
|
|
};
|
|
|
|
return directive;
|
|
|
|
function link(scope, element) {
|
|
$rootScope.$on('$stateChangeSuccess', listener);
|
|
|
|
function listener(event, toState) {
|
|
var applicationCoreTitle = 'CHD.im',
|
|
separeteBy = ' - ';
|
|
if (toState.data && toState.data.pageTitle) {
|
|
var stateTitle = $interpolate(toState.data.pageTitle)($state.$current.locals.globals);
|
|
element.html(applicationCoreTitle + separeteBy + $translate.instant(stateTitle));
|
|
} else {
|
|
element.html(applicationCoreTitle);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}());
|