簡體   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