Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

331
Views
Ant - Can't bind to 'ngModel' since it isn't a known property of 'nz-switch'

I'm using Ant Design for Angular (ng-zorro-antd), and using the simple switch module to display a switch.

When I add the code per the docs:

<nz-switch [ngModel]="true"></nz-switch>

The app won't compile, and I get this error:

Can't bind to 'ngModel' since it isn't a known property of 'nz-switch'

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Import FormsModule in the right module

While it doesn't say it in the documentation, you need to have Angular's FormsModule imported in order for the ngModel binding to work.

If you have an app with just one module, this is easy. Simply import the FormsModule as below in your one and only xxx.module.ts file.

If you're working on an app with multiple modules, as I was, you have to ensure you're importing it in the module where you're going to use the nz-switch

In that module, where you're using the nz-switch, in the xxx.module.ts file:

import { FormsModule } from '@angular/forms`;

... 

@NgModule({
  declaration: [ ... ],
  imports: [ 
    ...,
    FormsModule
  ],
  ...

You should be good to go.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!