|
|
|
@ -1,4 +1,7 @@ |
|
|
|
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', |
|
|
|
@ -6,8 +9,18 @@ import { Component, OnInit } from '@angular/core'; |
|
|
|
styleUrls: ['./home.component.css'] |
|
|
|
}) |
|
|
|
export class HomeComponent implements OnInit { |
|
|
|
showButton(){ |
|
|
|
alert("show cart clicked") |
|
|
|
} |
|
|
|
|
|
|
|
addCart(){ |
|
|
|
alert("added to cart") |
|
|
|
} |
|
|
|
|
|
|
|
constructor() { } |
|
|
|
products:Observable<Product[]> |
|
|
|
constructor(private productservice: ProductService) { |
|
|
|
this.products = this.productservice.showAllProduct(); |
|
|
|
} |
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
} |
|
|
|
|