Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

NO_ERRORS_SCHEMA tells Angular to accept any property on any element in a template, suppressing errors for unknown elements and properties. That broad allowance can hide misspellings and other template mistakes, so Angular generally discourages using it as a quick fix. For a custom web component, CUSTOM_ELEMENTS_SCHEMA may be a better fit; for a binding type error, investigate template type checking instead.

What does NO_ERRORS_SCHEMA do?

Angular checks template elements and property bindings against what is known in the component’s compilation context. A schema changes which otherwise-unrecognized elements or properties Angular accepts. The NO_ERRORS_SCHEMA API defines a schema that allows any property on any element. In practice, it suppresses template errors about unknown elements and unknown properties.

This can make a template compile when it contains elements or properties Angular does not recognize, but it also weakens validation. A typo in an element name or binding may no longer be caught as an unknown-element or unknown-property error. Angular says use of this schema is generally discouraged because it prevents useful validation and may hide real template errors.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose a fix based on the error

Unknown element or property from a web component

If the template uses a custom web component such as <my-widget> with dash-case properties, consider CUSTOM_ELEMENTS_SCHEMA. Angular documents this narrower schema for non-Angular elements named in dash case and dash-case element properties. It is not a blanket allowance for arbitrary unknown elements and properties. The advanced configuration guide shows schema configuration for this custom-elements case.

Unknown Angular component or directive

If the element is meant to be an Angular component or directive, check that it is available in the relevant compilation context rather than suppressing the error. A schema can make the diagnostic disappear without making the missing Angular declaration available to the template.

Binding type error

A type-checking complaint is different from an unknown-element or unknown-property error. Consult Angular’s template type-checking guidance to identify the specific expression or strictness check involved. For some false positives, Angular documents narrower options, including casting one expression with $any() or adjusting individual strictness flags. These approaches preserve more template checking than broadly allowing unknown elements and properties.

Where to configure a schema

Put the schema where the component is configured. Angular documents schemas for NgModules and, separately, for standalone components. The NgModule API lists NO_ERRORS_SCHEMA and CUSTOM_ELEMENTS_SCHEMA as allowed module schema values. The Component API documents a schemas property for standalone components and notes that this property is available only for standalone components.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For example, in a standalone component, schema metadata is supplied in the component decorator:

import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';

@Component({
  selector: 'app-host',
  standalone: true,
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  template: '<my-widget></my-widget>'
})
export class HostComponent {}

Use CUSTOM_ELEMENTS_SCHEMA in this example only when the template’s custom element and properties fit its documented scope. For an NgModule-based component, configure the schema in that module’s metadata instead. Check the API documentation for the Angular version and project structure in use.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What NO_ERRORS_SCHEMA does not mean

The schema is a template-acceptance rule for unknown elements and properties; it is not a general repair for every Angular compiler error. Nor does its documented purpose establish that Angular sanitization is disabled. Angular treats sanitization and template security separately in its security guidance. Diagnose the actual error before changing schemas.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.