Search code examples
typescriptassetsangular6

How to pass an ID to read a Json from assets folder


id = localStorage.getItem('currentUser')
this.http.get('./assets/id/profiles/admin.json')
                .subscribe(result => {
                  this.profile = result.json();
                });

Getting id values from local storage with that id, trying to read json. How to pass that id to read that particular json.


Solution

  • this.http.get('./assets/' + id +' /profiles/admin.json')
                   .subscribe(result => {
                     this.profile = result.json();
                   });