angular Errors
10 error patterns
angular3 fixes
ExpressionChangedAfterItHasBeenCheckedError (NG0100)
NG0100.*Expression has changed after it was checked
- •Move the value change to ngAfterViewInit with a ChangeDetectorRef.detectChanges() call
- •Use setTimeout(() => { ... }) to defer the change to the next cycle
angular3 fixes
Circular dependency in DI (NG0200)
NG0200.*Circular dependency in DI detected
- •Break the cycle by injecting one service lazily with `@Inject(forwardRef(() => ServiceName))`
- •Extract shared logic into a third service that both services depend on
angular3 fixes
NullInjectorError — missing provider
NullInjectorError: No provider for (\w+)
- •Add the service to the `providers` array of the module or component that needs it
- •Use `@Injectable({ providedIn: 'root' })` on the service class for app-wide singleton
angular3 fixes
Can't bind to property — not a known property (NG0303)
NG0303.*Can't bind to '.+' since it isn't a known property
- •Import the module that declares the directive/component (e.g., FormsModule for ngModel, ReactiveFormsModule for formControl)
- •Check for typos in the property name or directive selector
angular3 fixes
Angular hydration mismatch (NG0500)
NG0500.*hydration
- •Add `ngSkipHydration` attribute to components that use browser-only APIs
- •Move DOM manipulation to afterNextRender() or afterRender() instead of ngOnInit
angular3 fixes
Unknown element — component not declared (NG8001)
NG8001.*'([^']+)' is not a known element
- •Import the module that exports the component into your feature module's imports array
- •If standalone component, add it to the `imports` array of the consuming component
angular3 fixes
Unknown property binding (NG8002)
NG8002.*Can't bind to '(.+)' since it isn't a known property of '(.+)'
- •Import the required module (e.g., MatInputModule for matInput, RouterModule for routerLink)
- •Ensure the @Input() decorator is defined on the target component's property
angular3 fixes
Template export not found (NG0301)
NG0301.*Export of name '(.+)' not found
- •Ensure the directive is imported — e.g., FormsModule for `#f='ngForm'`
- •Check the exportAs property of the directive matches what you're referencing
angular3 fixes
Structural directive not available
Error: NG0901.*ngIf|ngFor|ngSwitch
- •Import CommonModule in your feature module's imports array
- •For standalone components, add CommonModule to the component's imports
angular3 fixes
Angular SSR hydration node mismatch
Error: NG05(04|05).*skip hydration
- •Add `ngSkipHydration` to dynamic content containers that change between server and client
- •Wrap browser-only rendering in `@if (isBrowser)` using isPlatformBrowser check