ng-select
ng-select copied to clipboard
Problem with ngModel property
Hello, I wanted to use ngModel property but couldn't. Do you have a solution for this? html: <ng-select [options]="pageSizes" [allowClear]="false" [noFilter]="Infinity" [(ngModel)]="nrOfPagesToDisplay">
ts: nrOfPagesToDisplay = '1';
Template parse errors: Can't bind to 'ngModel' since it isn't a known property of 'ng-select'.
- If 'ngModel' is an Angular directive, then add 'CommonModule' to the '@NgModule.imports' of this component.
- To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("s="input-container"><ng-select [options]="pageSizes" [allowClear]="false" [noFilter]="Infinity" [ERROR ->][(ngModel)]="nrOfPagesToDisplay">"): ng:///SharedModule/CustomPaginationComponent.html@16:78
Also broken for me
I got this to work by adding a name="foobar" prop to ng-select.
<ng-select name="state" [options]="states" [(ngModel)]="selectedOption">
I have the same problem, but adding name="some Name"
don't solved.
I also faced the Same issue. i got this to work by adding these lines in app.module.ts
import {FormsModule} from '@angular/forms'
@NgModule({
imports: [
BrowserModule,
FormsModule,
....
]
})
setting an option via ngmodel is still not working.
Adding FormsModule
to the module that uses ng-select
fixed the issue for me