2

I noticed that NO_ERRORS_SCHEMA is frequently used by nativescript modules both by the nativescript-schematics but also in examples by nativescript with Angular. However I'm just wondering why that is the case?

I guess there is a good explanation for this, I'm just not that into nativescript yet. Normally I would say using NO_ERRORS_SCHEMA should be avoided as it makes your debugging a lot harder so I'm very curious about why this is used everywhere.

Examples:

https://docs.nativescript.org/performance-optimizations/lazy-loading

https://github.com/NativeScript/nativescript-schematics/blob/master/src/generate/module/index.ts#L327

https://github.com/NativeScript/nativescript-schematics/blob/master/src/generate/module/index_spec.ts#L72

1 Answers1

5

NativeScript elements like StackLayout, GridLayout, ListView etc., are not known to Angular. So it will throw compiler error unless you include NO_ERRORS_SCHEMA.

But of course as you mentioned already, it might make debugging difficult. Once you specify NO_ERRORS_SCHEMA, the app will silently fail for any invalid elements.

Manoj
  • 21,753
  • 3
  • 20
  • 41
  • Is there any way to tell Angular that are part of Nativescript and only ignore the Nativescript elements. For example, installing a new package? – PhoneixS Aug 23 '19 at 09:16
  • You will have to register every element otherwise simply `NO_ERRORS_SCHEMA` would work. – Manoj Aug 23 '19 at 10:30