import { Component, OnInit } from '@angular/core'; import { ProductService } from './../../services/product.service'; import { Observable } from 'rxjs'; import { Product } from './../../models/product'; @Component({ selector: 'app-home', templateUrl: './home.component.html', styleUrls: ['./home.component.css'] }) export class HomeComponent implements OnInit { showButton(){ alert("show cart clicked") } addCart(){ alert("added to cart") } products:Observable constructor(private productservice: ProductService) { this.products = this.productservice.showAllProduct(); } ngOnInit(): void { } }