-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14073 from vmuresanu/issue-14062
fix: p-chips do not work with reactive forms
- Loading branch information
Showing
4 changed files
with
59 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Component, Input } from '@angular/core'; | ||
import { FormControl } from '@angular/forms'; | ||
import { Code } from '../../domain/code'; | ||
|
||
@Component({ | ||
selector: 'max-values-doc', | ||
template: ` <section class="py-4"> | ||
<app-docsectiontext [title]="title" [id]="id"> | ||
<p>Chips can have a maximum number of entered items. To set this limit, the <i>max</i> property is used, which accepts a numeric value that represents the maximum number of items in the chip list</p> | ||
</app-docsectiontext> | ||
<div class="card p-fluid"> | ||
<p-chips [formControl]="values" [max]="2" placeholder="Maximum 2 items"></p-chips> | ||
</div> | ||
<app-code [code]="code" selector="chips-max-values-demo"></app-code> | ||
</section>` | ||
}) | ||
export class MaxValuesDoc { | ||
@Input() id: string; | ||
|
||
@Input() title: string; | ||
|
||
values = new FormControl<string[] | null>(null); | ||
|
||
code: Code = { | ||
basic: `<p-chips [formControl]="values" [max]="max" placeholder="Maximum 2 items" ></p-chips>`, | ||
|
||
html: ` | ||
<div class="card p-fluid"> | ||
<p-chips [formControl]="values" [max]="max" placeholder="Maximum 2 items"></p-chips> | ||
</div>`, | ||
|
||
typescript: ` | ||
import { Component, OnInit } from '@angular/core'; | ||
import { FormControl, FormGroup } from '@angular/forms'; | ||
@Component({ | ||
selector: 'chips-max-values-demo', | ||
templateUrl: './chips-max-values-demo.html', | ||
styleUrls: ['./chips-max-values-demo.scss'] | ||
}) | ||
export class ChipsMaxValuesDemo { | ||
values = new FormControl<string[] | null>(null); | ||
max = 2; | ||
}` | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b280af2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
primeng-ssr-test – ./
primeng-ssr-test.vercel.app
primeng-ssr-test-primeng-test.vercel.app
primeng-ssr-test-git-master-primeng-test.vercel.app