Skip to content

docs: clarify value of the form control in the chips-form-control example #22995

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
</div>

<p>
Selected keywords: {{formControl.value}}
<i>Select a focused chip by pressing <code>SPACE</code></i>
</p>

<mat-form-field class="example-chip-list" appearance="fill">
<mat-label>Video keywords</mat-label>
<mat-chip-list #chipList aria-label="Video keywords" multiple [formControl]="formControl">
<mat-chip
*ngFor="let keyword of keywords"
(removed)="removeKeyword(keyword)">
*ngFor="let keyword of keywords"
[selected]="keyword"
[value]="keyword"
(removed)="removeKeyword(keyword)">
{{keyword}}
</mat-chip>
<input
Expand All @@ -21,3 +23,7 @@
(matChipInputTokenEnd)="addKeywordFromInput($event)">
</mat-chip-list>
</mat-form-field>

<p>
<b>The following keywords are selected:</b> {{formControl.value}}
</p>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {MatChipInputEvent} from '@angular/material/chips';
})
export class ChipsFormControlExample {
keywords = new Set(['angular', 'how-to', 'tutorial']);
formControl = new FormControl();
formControl = new FormControl(['angular']);

addKeywordFromInput(event: MatChipInputEvent) {
if (event.value) {
Expand Down