I haven't tried compiling it, but to me it looks as if the
[hidden]='!name.errors.required' notation is causing you issues when AOT
compiles the code. I don't think JIT settings are quite as strict.
I would try hidden]="name.errors['required']"
Cheers,
Geoff
On Tuesday, 22 November 2016 02:15:30 UTC+13, Kopleman wrote:
>
> Hello! I have a problem with AoT compilation.
> For example I have such form:
> <pre>
>
> <form #heroForm="ngForm" (ngSubmit)="addHero()">
> <label for="name">Hero name:</label>
> <input type="text" id="name" class="form-control"
> required
> name="name" [(ngModel)]="hero.name"
> #name="ngModel" >
> <button type="submit"
> [disabled]="!heroForm.form.valid" >Add</button>
> <div *ngIf="name.errors && (name.dirty || name.touched)"
> class="alert alert-danger">
> <div [hidden]="!name.errors.required">
> Name it!
> </div>
> </div>
> </form>
>
> </pre>
> It works fine with JiT compilation, but on AoT I have this error -
> <pre>Property 'required' does not exist on type '{ [key: string]: any;
> }'</pre>
> It concerns other validation types - pattern, min, max and etc.
> What have I missed?
>
--
You received this message because you are subscribed to the Google Groups
"Angular" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.