【发布时间】:2016-09-15 17:52:25
【问题描述】:
我的输入中出现以下错误:
SafeValue must use [property]=binding: http://www.myurl.com (see http://g.co/ng/security#xss)
我在我的组件中做了:
this.myInputURL = this.sanitizer.bypassSecurityTrustUrl('http://www.myurl.com');
在我的模板中:
Share URL: <md-input [value]="myInputURL" type="text"></md-input>
怎么了?
【问题讨论】:
-
你只想在输入控件中显示它?它说,将它注入 DOM 是不安全的
-
嗯.. 我没有看到任何其他选项允许快速轻松地复制链接 URL
-
也许您缺少正确的声明
public myInputURL: SafeResourceUrl;。有关详细信息,请参阅下面的答案。
标签: angular