Dynamic title with angular-meteor and ui-router


#1

Hello.
angular
angular-meteor
angular-ui-router

As you know in the tutorial parties from angular-meteor webpage, there exist a componentn called <navigation></navigation> and <ui-view></ui-view>

my question is:

how would be come to a dynamic title? I mean, that instead “Home title” will be a “Details title”, or others titles depend to the .state .
It’s possible to pass name variable to navigation component?

I think that with bindings in .components.config but I dont know how.

Thanks for you time


#2

Hi,

This is an easy way to change page title dynamically with ui-router:
<title ng-bind="pageTitle"></title>

angular.module('app', [])
  .run(($rootScope) ->
    $rootScope.$on('$stateChangeSuccess', (event, toState) => {
        $rootScope.pageTitle = toState.title;
    });
  )

function config($stateProvider) {
    'ngInject';
    $stateProvider
        .state('home', {
            url: '/home',
            template: '<home></home>',
            title: 'Home'
        });
}

BUT it won’t work in Meteor because the ngApp directive has to be on the HTML tag:


#3

I’ve just seen that your issue has already been resolved on stackoverflow. Here’s the link for the people who ran into the same issue: