I'm seeking guidance on how to create a text file or JSON file with dynamic data that can be downloaded. Below is the service code:
Service Code
validateUserData(userId) {
var headers = new Headers();
return this.http.get(`${this.baseUrl}/Users?userId=`+userId,{headers: headers}).map(result => {
return result.json();
});
}
Component.ts
this.service.validateUserData(userId).subscribe( res => {
console.log(res);
new Angular2Txt(res, 'My Report');
});
I want to send the Response to a text or JSON file for user download. How can I achieve this utilizing the Angular package?
I attempted using the above package but only managed to download an empty file.