ncuillery / angular-breadcrumb

Generate a breadcrumb from ui-router's states
http://ncuillery.github.io/angular-breadcrumb/
MIT License
785 stars 183 forks source link

Expose parameter for label from named view #180

Open jeserkin opened 7 years ago

jeserkin commented 7 years ago

I am using angular-ui-router: '0.2.18' and latest version of angular-breadcrumb.

State label consists of a translation code, that is translated in custom template as suggested here https://github.com/ncuillery/angular-breadcrumb/issues/65 by plugin author.

Translation has got a variable inside, that I would like to replace. The issue is, that the state uses named view and does not have a direct controller for it, since template for named view already has one.

// state
{
  parent: 'app',
  abstract: true,
  url: '/some/url/{id:int}',
  views: {
    'content@': {
      template: '<some-component></some-component>'
    }
  },
  /*
  resolve: {
    someId: $stateParams => {
      return $stateParams.id;
    }
  }
  */
  ncyBreadcrumb: {
    label: 'some.code.for.translation'
  }
}

What are the options then to pass the variable inside this label translation?

PS I did try the resolve option as well, but it did not replace {{$resolve.someId}} with value from url inside translation.

Thank you.