角5打字稿 - 保存本地JSON文件

问题描述 投票:2回答:1

我试着做一个本地的应用程序,为自己和保存在本地JSON的一切。我有这个帖子接口与阵列数据建立:

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文件呢?

json file typescript save angular5
1个回答
-1
投票
posting()      
   {
     this.http.post<any>(this.baseurl).map(res:Response=>{res.json();});
   }
ngOnInit()   
   {
     this.appService.posting().subscribe(data=>this.p=data);
   }
© www.soinside.com 2019 - 2024. All rights reserved.