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.

Breadcrumb Component doesn't support dynamic update of Breadcrumb Items

See original GitHub issue

Detailed description

Change breadcrumb.stories.ts to the following code:

import { storiesOf, moduleMetadata } from "@storybook/angular";
import { withNotes } from "@storybook/addon-notes";
import { action } from "@storybook/addon-actions";
import { withKnobs, boolean, number } from "@storybook/addon-knobs/angular";

import { BreadcrumbModule, DialogModule } from "../";
import { range } from "../common/utils";

const MAXIMUM_ITEM_COUNT = 50;

storiesOf("Breadcrumb", module)
	.addDecorator(
		moduleMetadata({
			imports: [BreadcrumbModule, DialogModule]
		})
	)
	.addDecorator(withKnobs)
	.add("Basic", () => ({
		template: `
		<ibm-breadcrumb [noTrailingSlash]="noTrailingSlash" [overflowThreshold]="overflowThreshold">
			<ibm-breadcrumb-item
			  *ngFor="let index of range(itemCount)"
				href="{{href(index)}}">
				Breadcrumb {{index}}
			</ibm-breadcrumb-item>
		</ibm-breadcrumb>`,
		props: {
			noTrailingSlash: boolean("noTrailingSlash", true),
			overflowThreshold: number("overflowThreshold", 4),
			itemCount: number("itemCount", 4),
			range: (stop: number, start = 0, step = 1) => {
				console.log("range: " + stop);
				let itemCount = Number(stop);
				if (isNaN(itemCount) || itemCount < 0) {
					itemCount = 0;
				}
				if (itemCount > MAXIMUM_ITEM_COUNT) {
					itemCount = MAXIMUM_ITEM_COUNT;
				}
				return range(itemCount, start, step);
			},
			href: (index: number) => {
				const uid = ("" + Math.random()).substr(2, 6);
				const href = "#_" + index + "_" + uid;
				console.log("href: " + href);
				return href;
			}
		}
	}));

The breadcrumb component doesn’t display the correct items with the item count knob is changed breadcrumb-items

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
cal-smithcommented, May 6, 2019

This seems to work with the model, and as far as I can tell everyone is good with that … closing!

1reaction
cal-smithcommented, Nov 12, 2018

And the overflow menu breaks sometimes when doing that.

At this point I’ve sunk a good couple days into this, and it seems to be a timing issue with ng-content, ng-template, and passing values between multiple levels … so not something we can easily fix (hopefully something that’s fixed with the new Ivy renderer, but we’re not there yet)

So yeah, if you want to switch to a model @markewallace I’d definitely go that way … collectively we’ve spent far too much time on this, and it’s not worth being stubborn over a usecase that’s impossible to implement correctly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Breadcrumb Component doesn't support dynamic update of ...
Breadcrumb Component doesn't support dynamic update of Breadcrumb Items ... The breadcrumb component doesn't display the correct items with ...
Read more >
Angular PrimeNG Breadcrumbs not changing dynamically
In the console log, I can see the new items getting added but the p-breadcrumbs in the HTML is not getting updated. The...
Read more >
15.3 Creating Breadcrumbs - Oracle Help Center
A breadcrumb is a hierarchical list of links that indicates where the user is within the application from a hierarchical perspective.
Read more >
9 Breadcrumb Tips to Make Your Site Easier to Navigate [+ ...
Take a look at nine tips and examples to ensure you're creating the most effective breadcrumb navigation for your users.
Read more >
Solved: HELP! with Service Portal breadcrumbs - ServiceNow
Solved: Hi A couple of years back we asked a vendor to re-style our portal, as part of that they created a new...
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