繁体   English   中英

Angular 5 Typescript-保存本地JSON文件

[英]Angular 5 Typescript - Save Local JSON File

我试图为自己创建一个本地应用,并将所有内容保存在json localy中。 我有这个帖子接口和数组与数据建立:

this.p = [{
      posts:{
        id: 'hey man',
        title:     'awdwada',
        description: 'awdawdaw',
        commands: {
            title: 'dawdawdawd',
            description: 'awdawda',
            note: 'wadadaw',
        }
      }

    }
    ];
     const r =  JSON.stringify(this.p);
      console.log(r);

如何将其保存到json文件中?

posting()      
   {
     this.http.post<any>(this.baseurl).map(res:Response=>{res.json();});
   }
ngOnInit()   
   {
     this.appService.posting().subscribe(data=>this.p=data);
   }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM