This repository has been archived by the owner on Aug 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): fix page-title directive (#1404)
- Loading branch information
Showing
2 changed files
with
32 additions
and
40 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
modules/core/client/directives/page-title.client.directive.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
40 changes: 0 additions & 40 deletions
40
modules/core/client/directives/page-title.client.directives.js
This file was deleted.
Oops, something went wrong.
Eslint throws "Move the invocation into the parens that contain the function wrap-iife"