#using @if automatically gives error
15 messages · Page 1 of 1 (latest)
@if (true) { }
`<div>
<form class="example-form">
<mat-form-field class="example-full-width">
<mat-label>Email</mat-label>
<input type="email" matInput placeholder="Ex. [email protected]">
<mat-hint>Errors appear instantly!</mat-hint>
@if (emailFormControl.hasError('email') && !emailFormControl.hasError('required')) {
<mat-error>Please enter a valid email address</mat-error>
}
@if (emailFormControl.hasError('required')) {
<mat-error>Email is <strong>required</strong></mat-error>
}
</mat-form-field>
</form>
</div>`
this is what i started with but i just started deleting html until i got to the root of the problem. being left with @if{} still leaves the same invalid eof error
By copying it in the Stackblitz example of the link you provided it works.
Try to restart ng serve
really?
yeah i already tried a restart
pasting in another component also gives me the same error
16 should have started with that my bad
That's an Angular 17 feature