Describe the bug
Adding string interpolation to an element inside a breadcrumb does not work when using soho-breadcrumb.
For example:
html
<nav soho-breadcrumb>
<li>
<span>{{someData}}</span>
</li>
</nav>
Does not display updates to the someData property. Changing to use simple markup does:
<nav class="breadcrumb">
<ol class="breadcrumb-list">
<li>
<span>{{someData}}</span>
</li>
</ol>
</nav>
<button soho-button (click)="increment()">Increment</button>
private _i = 1;
public get someData() {
return this._i;
}
public increment() {
console.log(`Incrementing ${this._i++}`);
}
To Reproduce
Steps to reproduce the behavior:
ids-enterprise-ng.npm run build)npm run start)http://localhost:4200/ids-enterprise-ng-demo/breadcrumb)Clicking the "Increment" button does not update the first breadcrumb but does the second.
Expected behavior
Both breadcrumbs should be updated.
Version
Screenshots
If applicable, add screenshots to help explain your problem.
Platform
Additional context
I believe this is due to underlying widget adding a button under the nav element.
Also, I tried adding a soho-breadcrumb-list component which sets the class for the order list to make sure the markup is HTML compliant. This did not fix the issue, so assume it might be related to the button.
Using the component without these calls in the AfterViewInit resolved the issue:
ngAfterViewInit() {
this.ngZone.runOutsideAngular(() => {
this.jQueryElement = jQuery(this.element.nativeElement);
// this.jQueryElement.breadcrumb(this.options);
// this.breadcrumbAPI = this.jQueryElement.data('breadcrumb');
});
}
This leads me to believe there is something occurring in the underlying widget which is breaking angular links to the page elements.
Also - the EP widget seems to be converting all the list item's content into anchors, e.g.
<span>{{someData}}</span>
is becoming
<a id="" class="hyperlink hide-focus" tabindex="0">1</a>
It looks like angular is loosing track of its templates as the EP widget is deleting the generated markup,
// If breadcrumbs are present, they are processed for settings and removed.
So is the suggest to just update our examples to use the full markup approach?
@tmcconechy - not sure - effectively there are two problems:
In my application at the moment, I have reverted to the standard markup without any component or EP widget integration. I wonder if there is a case leave the original HTML in place (if it exists) and just manipulate it rather than generating breadcrumb models?
I think perhaps for the angular case we just need to
a) let the original markup work
b) let a full expanded markup work (as this wont "correct" the DOM)
Probably an issue for @EdwardCoyle when he can get to it
For now I am using the following markup:
<soho-toolbar-flex-section [isTitle]="true">
<nav class="breadcrumb">
<ol class="breadcrumb-list">
<li class="breadcrumb-item">
<a soho-hyperlink (click)="navigateToUsers($event)">{{'UserFormUsersNavigationLabel' | sohoTranslate}}</a>
</li>
<li class="breadcrumb-item current">
<a soho-hyperlink id="new-user-breadcrumb">{{name}}</a>
</li>
</ol>
</nav>
</soho-toolbar-flex-section>
This mostly works okay, and gives the same styling as the breadcrumb widget.
Is there an option to have a non hyperlink with the same text styling but without the hover? the disabled option looks too greyed out.
Yes, just replace the <a> tag with a <span> and it will work.
If I do that the styling is all out.
Works in EP when i try it.
Ummmm .... same in NG (as in it works in NG). Must be some quirky styling in our app. Let me check it out.
Maybe it's the flex-toolbar, but a min-height is being added:

Which causes:

Using a hyperlink I get:

Ok, i bet the layout bug is to do with it being in a toolbar with spans moving around there. Might need some css to counter it when its in a toolbar
Yeah - maybe a flex-toolbar thing.
Will try and get to it next sprint
This issue is now resolved.