So starting first my nodejs server sends this as a response
"["name1","name2","name3"]"
but my angular 2 code for service is
return this.http.get(this.config.apiUrl + '/folder').map((response:Response)=> {
response.json();
console.log(response); }
How do I fetch the array?
if I use response._body there will be an error in npm start stating ._body undefined, So I make it as a comment then after npm start I reverse back, I know it is not proper way. Here is the console.log of above service code
Response
headers: Headers
ok:true
status:200
statusText:"OK"
type:2
url:"http://localhost:4000/folder"
_body:"["name1","name2","name3"]"
__proto__:Body
The main problem is to fetch in component in an array
Here, is the code I am trying
this.photoService.getAllfolder().subscribe(
data => {
console.log(data);
},
error => {
console.log(error);
});
please I am stuck with it for 3 days and it's urgent.
via siddharth ranjan
No comments:
Post a Comment