I'm attempting to build an Angular 2 project, using angular-cli with the --prod
and --aot
arguments. The build is failing with the following error:
Property 'required' does not exist on type '{ [key: string]: any; }'.
In my HTML, I'm using HTML validation on some of my inputs (required
, pattern
attributes).
Using JIT compilation, these work as expected. It is only during AoT compilation that the errors occur.
Has anyone seen this before? I was hoping not to have to resort to defining all of my forms using the ReactiveForms method and using the Angular Validators, unless there's no way around it.
The following are some things that will make AoT compile fail.
angular2-template-loader
plugin will change it to require at build time.form.controls.controlName
, use form.get(‘controlName’)
control.errors?.someError
, use control.hasError(‘someError’)