找不到名称'SafeUrl'
Cannot find name 'SafeUrl'
我试图从我添加的控制台中删除不安全的警告通过asssecuritytrusturl方法。但是我得到了错误
user.component.ts
import {Component,OnInit} from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { NavParams,Platform,ViewController } from 'ionic-angular';
@Component({
templateUrl:`<a [href]="sanitize('sms:'+user.mobile_no)" class="anchor-default">Text</a>`,
styles:[`
.anchor-black{color: #000; font-size: 2.4rem;}
.anchor-default {text-decoration: none;}
.custom-margin{margin-left:10px;}
.anchor-right{float:right;padding-top:2px;}
.text-content{text-overflow: ellipsis; vertical-align: middle; padding-top:12px;}
`]
})
export class User implements OnInit {
public user;
public bStandings:boolean = false;
constructor(
public navParams:NavParams,
public viewCtrl:ViewController,
public platform:Platform,
public domSanitizer:DomSanitizer
) {}
sanitize(url:string){
return this.sanitizeUrl(url);
}
private sanitizeUrl(url:string):SafeUrl {
this.bStandings = true;
return this.domSanitizer.bypassSecurityTrustUrl(url);
}
}
相关问题:类已经或正在使用名称'SafeUrl'从外部模块,但不能命名
谁来帮帮我,提前谢谢
直接导入SafeUrl
:
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
相关文章:
- 气质的“nestRemoting()”有时可以'找不到关系
- 错误405:向Java控制器(Ajax)发送JSON时找不到POST方法
- 找不到模块捆绑包
- for循环中的javascript if语句找不到==
- 为什么JavaScript可以'找不到给定的InnerHTML并返回Cannot set property
- 失败:等待Protractor与页面同步时出错:“”;在窗口上找不到角度”;
- Babel编译错误:找不到模块核心js/library/fn/get迭代器
- [Vue warn]:找不到元素
- ngRoute找不到模板
- 未能加载,因为找不到支持的源.当播放HTML5音频元素时
- 因果报应-找不到模块:错误:无法解析模块'scs'
- Angular 2:在本地.json文件上找不到文件
- module.js在运行iron节点时找不到模块
- 放大弹出生成“;找不到文件”;YouTube视频的错误
- 我发现了一些只在移动设备上可见的垃圾邮件链接,我可以'找不到包含此垃圾邮件链接的脚本的位置
- Web 地址虚拟目录会断开外部 JavaScript 链接,因此找不到文件
- Meteor.js可以'找不到语义:ui包
- 找不到容器:goog.Disposable.instances _在为javascript工具使用泄漏查找器时出错
- 错误:找不到模块'/lib/cli'
- 找不到名称'SafeUrl'