Skip to content

Commit b1c72ac

Browse files
authored
chore: replace *ngIf with @if (#78)
1 parent 2b41d49 commit b1c72ac

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

projects/ngx-mat-errors/src/lib/ngx-mat-errors.component.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AsyncPipe, NgIf, NgTemplateOutlet } from '@angular/common';
1+
import { AsyncPipe, NgTemplateOutlet } from '@angular/common';
22
import {
33
ChangeDetectionStrategy,
44
Component,
@@ -46,15 +46,15 @@ export const NGX_MAT_ERROR_DEFAULT_OPTIONS = new InjectionToken<
4646
@Component({
4747
selector: 'ngx-mat-errors, [ngx-mat-errors]',
4848
template: `<ng-template #defaultTemplate let-error>{{ error }}</ng-template
49-
><ng-template [ngIf]="error$ | async" let-error
50-
><ng-template
51-
[ngTemplateOutlet]="error.template ?? defaultTemplate"
52-
[ngTemplateOutletContext]="error"
53-
></ng-template>
54-
</ng-template>`,
49+
>@if( error$ | async; as error) {
50+
<ng-template
51+
[ngTemplateOutlet]="error.template ?? defaultTemplate"
52+
[ngTemplateOutletContext]="error"
53+
></ng-template>
54+
}`,
5555
encapsulation: ViewEncapsulation.None,
5656
changeDetection: ChangeDetectionStrategy.OnPush,
57-
imports: [NgIf, AsyncPipe, NgTemplateOutlet],
57+
imports: [AsyncPipe, NgTemplateOutlet],
5858
host: {
5959
class: 'ngx-mat-errors',
6060
},

0 commit comments

Comments
 (0)