1

I'm trying to output the name of a folder both as ncybreadcrumb label and as HTML page title, using a controller which populates a scope variable. See the code below:

state('messenger.folder', {
    url: '/:folder',
    ncyBreadcrumb: {label: '{{folderLabel}}' },
    data: {pageTitle: '{{folderLabel}}'},

    controller: function($scope,$stateParams) {
      $scope.folderLabel = $stateParams.folder;
      }
    }).

The strange thing is: It works perfectly for ncybreadcrumb, but not for page title: page-title is always empty.

Does anyone have an idea why this is the case and how to fix it?

cis
  • 1,053
  • 10
  • 32
  • How do you take `pageTitle`? – michelem Apr 11 '16 at 06:20
  • There's a controller for all states, which sets a scope variable "title" to `$state.$current.data.pageTitle` And that works. If I change `pageTitle: '{{folderLabel}}'` to `pageTitle: '>>{{folderLabel}}<>< – cis Apr 11 '16 at 06:33

1 Answers1

0

It could work for ncyBreadcrumb because the 3rd party lib angular-breadcrumb do special handling there.

I find a work round for dynamic title here:

How to dynamically change header based on AngularJS partial view?

Community
  • 1
  • 1
huan feng
  • 5,307
  • 1
  • 22
  • 40