Skip to content
Latchkey

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.

ng build
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

  1. Read which property and which element the error names.
  2. Add the owning module (FormsModule, RouterModule, a shared module) to the NgModule imports, or to a standalone component imports.
  3. Rebuild to confirm the binding resolves.
login.module.ts
@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.

login.component.ts
@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.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →