I working on angular and new at coding the issue i am facing is that i am fetching data from a 3rd party WebAPI and the output i am trying to save in array but the output is getting stored but i am not able to call particular data of array.
here is my code below need all of your kind support
MY CODE
import { Component, OnInit } from '@angular/core';
import { SharedService } from 'src/app/shared.service';
@Component({
selector: 'app-taglist',
templateUrl: './taglist.component.html',
styleUrls: ['./taglist.component.css']
})
export class TAGLISTComponent implements OnInit {
constructor(private service : SharedService) { }
Taglist:any=[];
TagStore:any=[];
FinalData:any=[];
ngOnInit(): void {
this.refreshTagslist();
}
refreshTagslist(){
this.service.gettaglist().subscribe(data=>{
this.Taglist = data;
//console.log(this.Taglist);
for(var i = 0; i < this.Taglist.Items.length;i++)
{
this.service.PITagValue= this.Taglist.Items[i].Links.Value;
this.service.gettagValue().subscribe(data=>{
this.TagStore = data;/* THE JSON RESPONE MENTION*/
this.FinalData.push(this.TagStore.Value);
})
}
console.log(this.FinalData)
console.log(this.FinalData[1]);
//console.log(this.Taglist.Items[0].Name);
})
}
}
JSON RESPONE
{
"Timestamp": "2022-01-12T12:15:37Z",
"Value": 1.0,
"UnitsAbbreviation": "",
"Good": true,
"Questionable": false,
"Substituted": false,
"Annotated": false
}
the output i am getting enter image description here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.