I am trying to dynamically update the page title.
Consider a state defined this way:
$stateProvider.state('login', { url: '/login', templateUrl: '/templates/views/login.html', controller: 'AuthCtrl', data: {title: 'Log in'} }
In the section of the HEAD section:
<title page-title></title>
According to the documentation, I should have access to the user data property :
app.directive("pageTitle", function ($state) { return { restrict: 'A', template: "{{title}}", scope: {}, link: function (scope, elem, attr) { scope.title=$state.current.data.title;
But this returns undefined . Any ideas? Thanks!
source share