Is there a way to access an object from the ngOnInit function and use it outside the class in the same component? Let me explain: I am implementing an Angular Material table and want to dynamically populate it with data retrieved from Firebase.
ngOnInit() {
this.productService.getProducts().subscribe(products => {
this.products = products;
})
}
const products = []
const ELEMENT_DATA: Element[] = products;
Check out the project here.