if(this.datashare.selectedtableId!=null) {
     console.log( "inside if condition");
     let resp= this.http.get(this.global.apiUrl+"columns/"+this.datashare.selectedtableId);
     resp.subscribe((data)=>this.users=data);
     console.log(this.users);
     this.count=this.users.length;
  }
when I console the users it shows all the data from API in my console like that (console.log(data)) But in my component, I try to get the data at the starting of the page by calling the service and assign it to a local variable it is giving undefined.
 
    