akveo / akveo/ng2-smart-table

How Read a JSON File using smart-table

未关闭
#538 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
1.6k
派生
867
PR 合并指标
30 天内没有已合并 PR

描述

This is what I have right now but I'm getting the 404 error saying that the data.json file is not found

`
data;
constructor(private http:Http) {
this.http.get('./data.json')
.subscribe(res => this.data = res.json());
console.log(this.data);
}

`
- I confirmed the JSON is valid
- The data.json file is under the same folder as app.component.ts
- I've imported Http from @angular/http and in app.component.ts
- I've imported HttpModule from @angular/http in app.module.ts and added HttpModule to imports
- The code is in
`export class AppComponent {
//....
}
`
in app.component.ts

Can anyone help me or have a separate example of how they read a json file (perhaps there's another technique)

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。