Skip to content
Loading
  • 0
    thank you for reply 
    only need to understand 
    what type of variable
    this.data 
    0
  • Veerendra Annigere
    0
    If you dont know the type , you can give any.
     
    1. public data: any;  
     
     
    1. import { ApiService } from "pathtoyourapiservice"      
    2.       
    3. export class YourComponent implements OnInit {      
    4.       
    5.   public data: any;  <========== This
    6.   
    7.   constructor(private apiService: ApiService) { }      
    8.       
    9.   ngOnInit() {      
    10.      this.apiService.getData().pipe(finalize(() => {      
    11.     })).subscribe(res => {      
    12.       this.data = res['_source']['Locations'][0]['Loc'];  <===== This    
    13.     }, err => {      
    14.     });      
    15.   }      
    16.       
    17. }     
    0