How Read a JSON File using smart-table
- 主要语言
- 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 还没有评估数据。