ng-select icon indicating copy to clipboard operation
ng-select copied to clipboard

Problem with ngModel property

Open Zoly90 opened this issue 7 years ago • 6 comments

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'.

  1. If 'ngModel' is an Angular directive, then add 'CommonModule' to the '@NgModule.imports' of this component.
  2. 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

Zoly90 avatar Oct 10 '17 08:10 Zoly90

Also broken for me

raysuelzer avatar Oct 18 '17 18:10 raysuelzer

I got this to work by adding a name="foobar" prop to ng-select.

<ng-select name="state" [options]="states" [(ngModel)]="selectedOption">

raysuelzer avatar Oct 18 '17 18:10 raysuelzer

I have the same problem, but adding name="some Name" don't solved.

FedeMadoery avatar Nov 22 '17 10:11 FedeMadoery

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,
    ....
  ]
})

jeevanhr7 avatar Dec 06 '17 10:12 jeevanhr7

setting an option via ngmodel is still not working.

bonaparte89 avatar Jan 02 '18 13:01 bonaparte89

Adding FormsModule to the module that uses ng-select fixed the issue for me

matiishyn avatar Jan 19 '18 13:01 matiishyn