I have the following code
ngOnInit(): void {
this.getQueryParams(this.generateSafeUrl);
}
getQueryParams(callback) {
this.route.queryParams.subscribe(params => {
let analysisId = params['analysisId'] || null;
callback({ analysisId, domain });
});
}
generateSafeUrl({ analysisId = null, domain = null }) {
let url = 'https://my-site.s3-eu-west-1.amazonaws.com/index.html';
if (analysisId && domain) {
url = `${url}?analysisId=${analysisId}&domain=${domain}`;
}
this.safeSrc = this.sanitizer.bypassSecurityTrustResourceUrl(url);
}
I miss the whole thing that if I don't use a callback and do the following, if it works and the error doesn't occur:
getQueryParams(callback) {
this.route.queryParams.subscribe(params => {
let analysisId = params['analysisId'] || null;
let domain = params['domain'] || null;
this.generateSafeUrl({ analysisId, domain });
});
}
I can't understand why the callback produces the error.