question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dynamic breadcrumb with resolve variable

See original GitHub issue

hi, im not sure if i am doing this right but… I have this state:

.state('main.applications.fase.utilizador.show', {
                url: '/:idUser',
                resolve: {
                    user: ['$state', '$stateParams', 'User',
                        function ($state, $stateParams, User) {
                            return User.getFromDB($stateParams.idUser, {
                                'fromAD': false,
                                'include': 'aluno,aluno.escolas,aluno.cursos,aluno.anosLetivos'
                            }).then(function (user) {
                                return user;
                            })
                        }]
                },
                views: {
                    'fase@main.applications.fase': {
                        templateUrl: 'app/applications/fase/utilizador/show.html',
                        controller: 'app.applications.fase.UtilizadorCtrl',
                        controllerAs: 'vm'
                    }
                },
                ncyBreadcrumb: {
                    label: 'app.fase.perfil.label'
                }
            });

And I want the label to be the user.id (user is on resolve) is it possible to do this? Use the resolve variables to dynamically do the ncy label?

Another thing, if i use controller as vm how can i use scope to make a dynamic label with {{ }} ?

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:7

github_iconTop GitHub Comments

8reactions
vjanssenscommented, Nov 12, 2015

This should be possible by setting {{ vm.user.id }} as the label. Unfortunately, in my case, this does not work when you refresh the page. The label will remain empty (this seems like a bug but I haven’t reproduced this in a plunkr). So this will only work when you click from another page to /:idUser page.

Another possibility is to update the label in your controller, by doing:

$state.current.ncyBreadcrumb.label = 'Your custom breadcrumb here'
0reactions
soumyartcommented, Dec 19, 2017

@go4varuntyagi : I used both

$state.current.ncyBreadcrumb.label = 'Your custom breadcrumb here';
$state.current.ncyBreadcrumbLabel = 'Your custom breadcrumb here';

Instead of only $state.current.ncyBreadcrumb.label = 'Your custom breadcrumb here' and it worked.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular breadcrumbs with dynamic label - Stack Overflow
The interface defines a resolve() method that is invoked when the navigation starts. The router waits for the data to be resolved before...
Read more >
Build dynamic breadcrumb routes and child routes with ...
My current understanding is that React Router and nested routes seem to work by each level of the router owning its own routes...
Read more >
Implement a Dynamic Breadcrumb in React/NextJS
Breadcrumbs are a website navigation tool that allows a user to see their current page's "stack" of how it is nested under any...
Read more >
Angular Breadcrumbs with Complex Routing and Navigation
URL segment, matrix, and query parameters; Active router links and styles; Route guards; Primary and secondary routes; Lazy-loading or dynamic- ...
Read more >
Rails Tutorial | Adding Dynamic Breadcrumbs to a Rails App
In this Ruby on Rails tutorial, we're going to create a method for easily adding dynamic breadcrumbs to our application without complex ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found