Skip to content

Commit e3f2df8

Browse files
committed
edit icon should be independent from editable
1 parent c3dfdb3 commit e3f2df8

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

src/dev-app/chips/chips-demo.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ <h4>Multi selection</h4>
160160

161161
<mat-checkbox [(ngModel)]="disableInputs">Disabled</mat-checkbox>
162162
<mat-checkbox [(ngModel)]="editable">Editable</mat-checkbox>
163+
<mat-checkbox [(ngModel)]="showEditIcon">Show Edit Icon</mat-checkbox>
163164
<mat-checkbox [(ngModel)]="disabledInteractive">Disabled Interactive</mat-checkbox>
164165

165166
<h4>Input is last child of chip grid</h4>
@@ -172,9 +173,11 @@ <h4>Input is last child of chip grid</h4>
172173
[editable]="editable"
173174
(removed)="remove(person)"
174175
(edited)="edit(person, $event)">
175-
<button matChipEdit aria-label="Edit contributor">
176-
<mat-icon>edit</mat-icon>
177-
</button>
176+
@if (showEditIcon) {
177+
<button matChipEdit aria-label="Edit contributor">
178+
<mat-icon>edit</mat-icon>
179+
</button>
180+
}
178181
{{person.name}}
179182
<button matChipRemove aria-label="Remove contributor">
180183
<mat-icon>close</mat-icon>

src/dev-app/chips/chips-demo.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export class ChipsDemo {
5252
listboxesWithAvatar = false;
5353
disableInputs = false;
5454
editable = false;
55+
showEditIcon = false;
5556
disabledInteractive = false;
5657
message = '';
5758

src/material/chips/chip-row.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,9 @@ export class MatChipRow extends MatChip implements AfterViewInit {
148148
}
149149

150150
override _edit(): void {
151-
if (!this.disabled && this.editable) {
152-
// markForCheck necessary for edit input to be rendered
153-
this._changeDetectorRef.markForCheck();
154-
this._startEditing();
155-
}
151+
// markForCheck necessary for edit input to be rendered
152+
this._changeDetectorRef.markForCheck();
153+
this._startEditing();
156154
}
157155

158156
private _startEditing(event?: Event) {

0 commit comments

Comments
 (0)