在另一页上调用函数时;它的参数“this”与前一页的参数“this”相同。
从CheckAuthorizationOnClickDirective页面调用的函数;
export class CheckAuthorizationOnClickDirective {
user: Observable<User>;
@Input() allowedClaim: any;
@Input() checkAuthOnClick = () => { };
observer: MutationObserver;
constructor(private element: ElementRef,
private store: Store<fromRoot.State>) {
this.element = element.nativeElement;
}
@HostListener('click', ['$event, $event.target'])
onClick(event, targetElement) {
if (!this.checkAuth()) {
this.checkAuthOnClick() //calling loadForm function
}
}
...
InvoiceDesignListPage中的功能;
loadForm() {
this.router.navigate(['/ayarlar/fatura-gorsel/duzenle', this.selectedInvoiceDesign.Id]);
}
但是“this”键值是CheckAuthorizationOnClickDirective,因此会出现异常。