Angular "Can't bind to X since it isn't a known property" in CI
The AOT template compiler could not find a directive or component that declares the property you bound to. The owning module (or standalone imports) is missing the declaration, so the binding is unknown at compile time.
What this error means
ng build fails with "Can't bind to 'ngModel' since it isn't a known property of 'input'" or similar, pointing at a template file and line.
Error: src/app/login/login.component.html:4:12 - error NG8002:
Can't bind to 'ngModel' since it isn't a known property of 'input'.Common causes
The module that owns the directive is not imported
Binding to ngModel needs FormsModule; binding to a component input needs that component declared or imported in the current module.
A standalone component missing the import
A standalone component must list the directive/component (or module) in its own imports array; omitting it makes the property unknown.
How to fix it
Import the module or component that declares the property
- Read which property and which element the error names.
- Add the owning module (FormsModule, RouterModule, a shared module) to the NgModule imports, or to a standalone component imports.
- Rebuild to confirm the binding resolves.
@NgModule({
imports: [FormsModule],
declarations: [LoginComponent],
})
export class LoginModule {}For standalone components, add to imports
List the required module or component directly in the standalone component decorator.
@Component({
standalone: true,
imports: [FormsModule],
templateUrl: './login.component.html',
})
export class LoginComponent {}How to prevent it
- Import FormsModule/ReactiveFormsModule where you use their directives.
- Keep shared directives in a shared module and import it consistently.
- For standalone components, keep the imports array complete.