I created a custom component and applied it on
<input [ERR]="' '" required ngModel name="leaseagreement" type="file" (change)="onFileChange()">
[ERR] is created to show error, but hook event of that component ngOnChanges is not performing on selection of file. If any way to trigger it, Please share.
@Component ({
selector:'[ERR]',
template:`<template #validationref>
<span class="ERR2">{{error}}</span>
</template>
<ng-content></ng-content>
`
})
export class ERR implements OnInit {
@Input() ERR:string;
@Input() ngModel:string;
@ViewChild('validationref') validationref;
public error:string = "";
ngOnInit() {
}
ngOnChanges(args: any[]) {
// my error plugin code
}
}