How to access this variable that is out of escope?
export class ClientsComponent implements OnInit { title: string = "All Clients"
clients: Client[] = [];
response: any;
total_clients: number;
total_pages: number;
pages: any[] = [];
constructor( private _clientService: ClientService ) {}
ngOnInit() {
this._clientService.getData()
.subscribe(
data => this.response = data,
err => console.error(err),
() => {
this.clients = this.response.data,
this.total_clients = this.response.total
}
);
console.log(this.total_clients); <- i can not access this
}