在Angular 4中将新对象添加到本地json文件

时间:2017-08-30 09:26:20

标签: json angular

我有一个简单的方法来调用位于我的资产文件夹

中的json文件
    private jsonPath = '../assets/data/sample.json';
    constructor(private http: Http) { 
    http.get(this.jsonPath)
    .subscribe(response => {
      this.posts = response.json();
    })

在阅读它时效果很好但是我想在它上面执行CRUD操作(例如创建一个新对象)。有可能吗?

0 个答案:

没有答案