错误:拒绝访问财产的权限"拒绝"在钓鱼者2

时间:2017-01-23 10:41:56

标签: javascript angular

我得到"错误:拒绝访问财产的权限"拒绝""垂钓者2中的错误。请参见下图:

Firefox的屏幕截图

enter image description here

Chrome屏幕截图 enter image description here

我在 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) }}

1 个答案:

答案 0 :(得分:2)

data?.qwqw

在变量中使用问号 它将确保var未定义