0
0
SSShreyans Shah
The ngOnInit() function is run when the AngularJS application is initialized. This function ensures that the data for the products object is loaded from the route's snapshot object. This object is populated by the _route.snapshot.data.products method. This method is called whenever the route's data is evaluated. In this case, it will grab all of the products from the URL.
Library: angular
ngOnInit() {
this.products = this._route.snapshot.data.products;
console.log('products: ', this.products);
}