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

Commit

Permalink
fix(core): fix page-title directive (#1404)
Browse files Browse the repository at this point in the history
  • Loading branch information
mleanos authored Jul 18, 2016
1 parent 1600705 commit 8287537
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 40 deletions.
32 changes: 32 additions & 0 deletions modules/core/client/directives/page-title.client.directive.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
(function () {
'use strict';

angular.module('core')
.directive('pageTitle', pageTitle);

pageTitle.$inject = ['$rootScope', '$interpolate', '$state'];

function pageTitle($rootScope, $interpolate, $state) {
var directive = {
retrict: 'A',
link: link
};

return directive;

function link(scope, element) {
$rootScope.$on('$stateChangeSuccess', listener);

function listener(event, toState) {
var applicationCoreTitle = 'MEAN.js',
separeteBy = ' - ';
if (toState.data && toState.data.pageTitle) {
var stateTitle = $interpolate(toState.data.pageTitle)($state.$current.locals.globals);
element.html(applicationCoreTitle + separeteBy + stateTitle);
} else {
element.html(applicationCoreTitle);
}
}
}
}
})();

This comment has been minimized.

Copy link
@hyperreality

hyperreality Jul 18, 2016

Contributor

Eslint throws "Move the invocation into the parens that contain the function wrap-iife"

This comment has been minimized.

Copy link
@lirantal

lirantal Jul 18, 2016

Member
40 changes: 0 additions & 40 deletions modules/core/client/directives/page-title.client.directives.js

This file was deleted.

0 comments on commit 8287537

Please sign in to comment.