我在 Angler 2 中收到“错误:访问属性“拒绝”的权限被拒绝”错误。请参见下图:
Firefox 截图
我在services.js 文件中添加了以下代码
getFooter(){
return this.http.get(this.cons.footer)
.map(response => response.json());
}
我在组件文件中使用了以下代码
ngOnInit(){
this._pageService.getFooter()
.subscribe(
data => this.data = data.data,
error => console.log(error)
);
}
我正在使用下面的 json 文件。
{
"status": "success",
"data": {
"qwqw":"qqq",
"footer_column_first": [
"Alien Education",
"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley. ",
[
[
"http://facebook.com",
"uploads/453085f6fb34252eeb15e26c381daf9b.jpg"
],
[
"http://twitter.com",
"uploads/8c542d463e812318f71271a41850fd41.jpg"
],
[
"http://linkedin.com",
"uploads/c29507573b1434ae96783c749248d958.jpg"
],
[
"http://youtube.com",
"uploads/e311b879e07c9a6a8c924f758566e28f.jpg"
]
]
]
}
}
我在模板 (.html) 中使用了打击代码。但我遇到了以下错误
{{ console.log(data.qwqw) }}
最佳答案
data?.qwqw
在变量中使用问号
它将确保 var
不是未定义的
关于javascript - 错误 : Permission denied to access property "rejection" in angler 2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41804404/