Skip to content

Breadcrumb unusable with multiple ui-views #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dotnetwise opened this issue Dec 11, 2014 · 14 comments
Open

Breadcrumb unusable with multiple ui-views #62

dotnetwise opened this issue Dec 11, 2014 · 14 comments
Labels

Comments

@dotnetwise
Copy link

When you have multiple ui-views, the ncyBreadcrumb.parent function gets executed for each of the views.
This is not correct, you should be able to specify for what view/controller/scope to get the parent and label executed against.

How can you do that?

@ncuillery
Copy link
Owner

Right, I always had this issue in mind, it is the major reason why the module is still in 0.x.x version (it is a global issue, not specific to the parent property.

For me, the smartest way to resolve this bug is to add a new property in ncyBreadcrumb for state with multiple views:

$stateProvider
  .state('report',{
    ncyBreadcrumb: {
      label: 'Multiple views state',
      mainView: 'tabledata'
    },
    views: {
      'filters': {
        templateUrl: 'report-filters.html',
        controller: function($scope){ ... controller stuff just for filters view ... }
      },
      'tabledata': {
        templateUrl: 'report-table.html',
        controller: function($scope){ ... controller stuff just for tabledata view ... }
      },
      'graph': {
        templateUrl: 'report-graph.html',
        controller: function($scope){ ... controller stuff just for graph view ... }
      },
    }
  })

where mainView points one of the view defined in the ui-router views property.

But I can't say yet if I can access to the multiple views of the state and generate the breadcrumb only with the main view.

@jamhall
Copy link

jamhall commented Dec 18, 2014

It would be fantastic if this is implemented - I am currently facing the same issue. +1 :-)

@jancel
Copy link

jancel commented Jan 7, 2015

+1 It's popped up here too

@thisispaul
Copy link

+1 I think this would solve my current problem of the label not being parsed properly because of the different views.

@thisispaul
Copy link

I just had a look at this to try and solve it for myself.

I'm guessing the ideal place to check the mainView would be when getting the $lastViewScope on $viewContentLoaded but I can't see any way tosee what view a scope belongs to.

Any ideas?

@leedavidr
Copy link

+1, I don't have multiple views, but I define a single view in the state's views config object.

I'm not able to read the scope variable in the label.

@przemyslawlis
Copy link

+1

1 similar comment
@slakin
Copy link

slakin commented Jun 16, 2015

+1

@Sorackb
Copy link

Sorackb commented Jun 16, 2015

Just did a pull request to solve this issue. #93

Sorackb added a commit to Sorackb/angular-breadcrumb that referenced this issue Jun 16, 2015
@brazorf
Copy link

brazorf commented Jul 7, 2015

+1
Any chance to see this pull request merged?

kazinov pushed a commit to kazinov/angular-breadcrumb that referenced this issue Aug 6, 2015
…ering breadcrumbs. The property ncyBreadcrumbIgnore should be set to true on the view controller.

This also could help with the issue ncuillery#62
kazinov pushed a commit to kazinov/angular-breadcrumb that referenced this issue Aug 6, 2015
Provide the way to ignore some views when rendering breadcrumbs. To achieve this the property ncyBreadcrumbIgnore should be set to true on the view controller scope. This also could help with the issue ncuillery#62
kazinov pushed a commit to kazinov/angular-breadcrumb that referenced this issue Aug 7, 2015
Provide the way to ignore some views when rendering breadcrumbs. To achieve this the property ncyBreadcrumbIgnore should be set to true on the view controller scope.

Closes ncuillery#42 ncuillery#62
@ncuillery
Copy link
Owner

I thought this issue has been automatically closed by 934c552 but I hasn't 😄

@ncuillery
Copy link
Owner

I reopen the issue to remind myself I must mention the ncyBreadcrumbIgnore in docs (a new entry "FAQ" I think)

@ptitdje45
Copy link

ptitdje45 commented Jan 18, 2017

@ncuillery Can you explain where i should use ncyBreadcrumbIgnore i'm a bit lost ..

@ptitdje45
Copy link

ptitdje45 commented Jan 18, 2017

Example working here : http://plnkr.co/edit/yeODlzws6gv05tZ7nURd?p=preview

Note that if you are re-using the view somewhere else and you want to display the route. This will not work anymore. So try to find a way to 'true' or 'false' $scope.ncyBreadcrumbIgnore.

angular.module('app', ['ui.router', 'ncy-angular-breadcrumb'])
  .config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) {
    $stateProvider
        .state('A', {
            abstract: true,
            url: '/a',
            views: {
                'a@': {
                    template: '<div>View A</div>',
                    controller: 'ACtrl'
                }
            }
        })
        .state('A.B', {
            url: '/b',
            views: {
                'b@': {
                    template: '<div>View B</div>',
                    controller: 'BCtrl'
                }
            },
            ncyBreadcrumb: {
                label: 'State {{tripleB}}'
            }
        });

    $urlRouterProvider.otherwise('/a/b');
  }])
  .controller('ACtrl', function($scope) {
    
    $scope.ncyBreadcrumbIgnore = true;
    console.log('a');
  }).controller('BCtrl', function($scope) {
    console.log('b');
    $scope.tripleB = 'BBB';
  })
  .run(function($rootScope, $location) {
    $rootScope.$location = $location;
  });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.