Sky.Net/client/src/app/shop/shop.component.ts

27 lines
658 B
TypeScript
Raw Normal View History

2022-05-12 16:52:52 -07:00
import { Component, OnInit } from '@angular/core';
import { IProduct } from '../shared/models/product';
import { ShopService } from './shop.service';
@Component({
selector: 'app-shop',
templateUrl: './shop.component.html',
styleUrls: ['./shop.component.scss']
})
export class ShopComponent implements OnInit {
products: IProduct[];
constructor(private shopService: ShopService) { }
ngOnInit(): void {
this.shopService.getProducts().subscribe(
{
next: (response) => { this.products = response.data; },
error: (e: any) => { console.log(e); },
complete: () => { console.log('complete'); }
}
);
}
}