【发布时间】:2018-06-11 11:07:15
【问题描述】:
我正在尝试访问存储在 .json 文件中的输入数据,但由于某种原因无法识别我的路径:
此方法在请求数据时运行:
getData() {
console.log('this is working');
this.http.get('src/app/inputs/inputs.json')
.subscribe(
(data: any) => {
console.log('this is working');
console.log(data.text());
}
);
}
}
这是我的文件夹结构:
只要单击单独的按钮,我就可以添加数据,只是检索它是我卡住的地方。
【问题讨论】:
-
使用 ng-resource
-
具体怎么做?
标签: angular