Placeholder not displayed when using ng-select with formGroupName (when the form is loaded)
See original GitHub issueExpected behaviour
The placeholder should be dispalyed when the form is loaded
Actual behaviour
The input field is blanc (empty)
<form [formGroup]="form.group">
<div class="form-group" formGroupName="adress">
<label class="font-weight-bold"> Street</label>
<ng-select placeholder="Select street" [items]="streets" formControlName="street"
required bindLabel="label" bindValue="code">
</ng-select>
</div>
</form>
More Info
ng-select version: 2.1.3
browser: Chrome Version 67.0.3396.87
reproducible in demo page: No (It would be appreciated if added in the Demo page)
Thank you in advance.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:16 (5 by maintainers)
Top Results From Across the Web
angular - placeholder not shown in ngselect - Stack Overflow
I found the solution finally, it's not in relation to the [multiple] attribute but the way to initialize my FormGroup, ...
Read more >Resolved: ng-select placeholder not showing - truecodex.com
Fixed issue of placeholder not displayed when using ng-select in reactive form in Angular 6/7/8. Use null inseated of single quote ('') for ......
Read more >How To Always Display A Placeholder Of Ngselect? - ADocLib
Placeholder not displayed when using ngselect with formGroupName when the form is loaded #653.Closed.yeddaalous opened this issue on Jul.
Read more >FormGroupName - Angular
Accepts a name as a string or a number. The name in the form of a string is useful for individual forms, while...
Read more >Ng Select Example (forked) - StackBlitz
<form [formGroup]="form". novalidate>. <h1>Angular ng-select <small ... ng-select">Open in Github</a></. small></h1> ... placeholder="Select City".
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks, now I clearly see the issue. First param of
FormControl
is value, so changingnew FormControl(null, Validators.required)
works as expected.You don’t see label because your model is set with valid value, empty object is also valid. You should use null or undefined in your case.