Can t bind to ngclass since it isn t a known property of input

0 votes
Can you tell me Can't bind to 'ngclass' since it isn't a known property of 'input'?
Mar 11 in Java-Script by Ashutosh
• 23,230 points
63 views

1 answer to this question.

0 votes

This error occurs because Angular does not recognize ngClass on an <input> element. The likely reasons are:

Missing CommonModule Import (if using Angular modules)

Ensure CommonModule is imported in the module where the component is declared.

import { CommonModule } from '@angular/common';

Missing BrowserModule Import (for standalone apps)

Ensure BrowserModule is imported in app.module.ts.

Typo or Incorrect Usage

Ensure ngClass is correctly used with square brackets ([ngClass]) and bound to a valid object or expression.

<input [ngClass]="{'class-name': condition}" />

Component Not Declared in the Right Module

Ensure the component using ngClass is declared in a module that imports CommonModule.

answered Mar 11 by Tanvi

Related Questions In Java-Script

+1 vote
1 answer

How to implement up and down voting of a particular thread?

Hello @kartik, Yes, JavaScript is involved. There are ...READ MORE

answered Jun 3, 2020 in Java-Script by Niroj
• 82,840 points
1,569 views
0 votes
1 answer

How to list the properties of a JavaScript object?

Hii @kartik, Use Reflect.ownKeys(): var obj = {a: 1, b: ...READ MORE

answered Jun 8, 2020 in Java-Script by Niroj
• 82,840 points
1,148 views
0 votes
3 answers
0 votes
1 answer

How to get “value” of file upload input field in jquery?

Hello @kartik, Yes ,you can read the value ...READ MORE

answered Jul 8, 2020 in Java-Script by Niroj
• 82,840 points
13,305 views
0 votes
1 answer

How to Center a Single-Column Div Within a 12-Column Container in Bootstrap 3?

Using Bootstrap's Offset Classes Bootstrap 3 provides offset ...READ MORE

answered Mar 11 in Node-js by Tanvi
69 views
0 votes
1 answer

How to get current financial year in PHP?

You can get the current financial year ...READ MORE

answered Mar 11 in Laravel by Sanvi
109 views
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP