Skip to content

Commit b487e4c

Browse files
committed
fix(breadcrumb-item): remove attributes input conflicting with Element's readonly property, use attribs instead
1 parent 4ea891f commit b487e4c

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

projects/coreui-angular/src/lib/breadcrumb/breadcrumb-item/breadcrumb-item.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@if (!active()) {
22
<a [routerLink]="url()"
3-
[cHtmlAttr]="attributes() ?? {}"
4-
[target]="attributes()?.['target']"
3+
[cHtmlAttr]="attribs() ?? {}"
4+
[target]="attribs()?.['target']"
55
[queryParams]="linkProps()?.queryParams ?? null"
66
[fragment]="linkProps()?.fragment"
77
[queryParamsHandling]="linkProps()?.queryParamsHandling ?? null"
@@ -13,7 +13,7 @@
1313
<ng-container *ngTemplateOutlet="defaultBreadcrumbItemContentTemplate" />
1414
</a>
1515
} @else {
16-
<span [cHtmlAttr]="attributes() ?? {}">
16+
<span [cHtmlAttr]="attribs() ?? {}">
1717
<ng-container *ngTemplateOutlet="defaultBreadcrumbItemContentTemplate" />
1818
</span>
1919
}

projects/coreui-angular/src/lib/breadcrumb/breadcrumb-item/breadcrumb-item.component.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { booleanAttribute, Component, computed, input } from '@angular/core';
1+
import { booleanAttribute, Component, computed, effect, input } from '@angular/core';
22
import { NgTemplateOutlet } from '@angular/common';
33
import { RouterModule } from '@angular/router';
44

@@ -25,19 +25,26 @@ export class BreadcrumbItemComponent {
2525

2626
/**
2727
* The `url` prop for the inner `[routerLink]` directive. [docs]
28-
* @type string
28+
* @return string
2929
*/
3030
readonly url = input<string | any[]>();
3131

3232
/**
3333
* Additional html attributes for link. [docs]
34-
* @type INavAttributes
34+
* @return INavAttributes
3535
*/
36-
readonly attributes = input<INavAttributes>();
36+
readonly attribs = input<INavAttributes>();
37+
protected readonly _attributes = input<INavAttributes>(undefined, { alias: 'attributes' });
38+
39+
readonly #attributesEffect = effect(() => {
40+
if (this._attributes()) {
41+
console.error('c-breadcrumb-item: [attributes] prop is removed, use [attribs] instead:', this._attributes());
42+
}
43+
});
3744

3845
/**
3946
* Some `NavigationExtras` props for the inner `[routerLink]` directive and `routerLinkActiveOptions`. [docs]
40-
* @type INavLinkProps
47+
* @return INavLinkProps
4148
*/
4249
readonly linkProps = input<INavLinkProps>();
4350

0 commit comments

Comments
 (0)