Skip to content
This repository was archived by the owner on Aug 30, 2021. It is now read-only.

Commit 8287537

Browse files
authored
fix(core): fix page-title directive (#1404)
1 parent 1600705 commit 8287537

File tree

2 files changed

+32
-40
lines changed

2 files changed

+32
-40
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
(function () {
2+
'use strict';
3+
4+
angular.module('core')
5+
.directive('pageTitle', pageTitle);
6+
7+
pageTitle.$inject = ['$rootScope', '$interpolate', '$state'];
8+
9+
function pageTitle($rootScope, $interpolate, $state) {
10+
var directive = {
11+
retrict: 'A',
12+
link: link
13+
};
14+
15+
return directive;
16+
17+
function link(scope, element) {
18+
$rootScope.$on('$stateChangeSuccess', listener);
19+
20+
function listener(event, toState) {
21+
var applicationCoreTitle = 'MEAN.js',
22+
separeteBy = ' - ';
23+
if (toState.data && toState.data.pageTitle) {
24+
var stateTitle = $interpolate(toState.data.pageTitle)($state.$current.locals.globals);
25+
element.html(applicationCoreTitle + separeteBy + stateTitle);
26+
} else {
27+
element.html(applicationCoreTitle);
28+
}
29+
}
30+
}
31+
}
32+
})();

modules/core/client/directives/page-title.client.directives.js

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)