angular移除模板文件中的链接前缀“unsafe”
Use the DomSanitizer:
import {DomSanitizer} from '@angular/platform-browser';
...
constructor(private sanitizer:DomSanitizer){}
...
let sanitizedUrl = this.sanitizer.bypassSecurityTrustUrl('Notes://MYSERVER/C1256D3B004057E8');
or create a method to return the sanitized url:
sanitize(url:string){
return this.sanitizer.bypassSecurityTrustUrl(url);
}
and then in your template:
<a [href]="sanitize('Notes://MYSERVER/C1256D3B004057E8')" ..


