我有一个在特定端口上运行的仪表板应用程序。
Angular应用程序在不同的端口上运行。
根据一些文档,我已经使用了代理。
这是proxy.conf.json文件中的内容
{
"/apik/*": {
"target": "http://localhost:8123/dashboard",
"secure": false
}
}
在ts文件中,我将网址设置为
url = 'apik/'
在HTML文件中,我使用iFrame如下打开仪表板
<iframe [src]="url" style="width: 100%;height: 500;border: none;"></iframe>
但是我遇到以下错误
ERROR Error: unsafe value used in a resource URL context (see http://g.co/ng/security#xss)
我尝试如下使用HTML中的消毒剂
<iframe [src]="sanitizer.bypassSecurityTrustResourceUrl(url)" style="width: 100%;height: 500;border: none;"></iframe>
但这会两次打开同一页面。
我正在使用以下代码
ng serve --proxy-config proxy.conf.json
这正确吗?
能请你帮忙吗?
答案 0 :(得分:0)
尝试一下
instance NFData Op where
-- (seq/deepseq) x y is defined by
-- "if you want to evaluate (seq/deepseq) x y to WHNF, then you must
-- evaluate x to WHNF/NF, then evaluate y to WHNF."
-- but e.g. Add is already in WHNF and NF, so seq Add and deeqseq Add are no-ops
-- the actual evaluation is already finished by the case in rnf's equations
-- you could even write rnf x = x `seq` (), but I think it's best to be explicit
rnf Add = ()
rnf Sub = ()
rnf Mul = ()
rnf Div = ()
instance NFData Expr where
rnf (Val a) = a `deepseq` ()
-- rnf o, rnf l :: ()
-- WHNF and NF are the same thing for the type (); all constructors are nullary
-- therefore (deepseq (rnf x) y) = seq (rnf x) y
-- but then seq (rnf x) y = deepseq x y {by definition}
rnf (App o l r) = o `deepseq` l `deepseq` rnf r
然后...
public url: string;
constructor(private sanitizer: DomSanitizer){
this.url = this.sanitizer.bypassSecurityTrustResourceUrl('apik/');
}