You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

27 lines
704 B

import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { Products } from 'src/app/model/Products';
import { ProductsService } from 'src/app/service/products.service';
@Component({
selector: 'app-fruits',
templateUrl: './fruits.component.html',
styleUrls: ['./fruits.component.css']
})
export class FruitsComponent implements OnInit {
products:Products[];
name:string;
constructor(private productsService:ProductsService, private route:Router) {
this.products=[];
this.name='Fruits & Veggies';
}
ngOnInit(): void {
this.productsService.getProductsByCategory(this.name).subscribe(data=>{
this.products=data;
})
}
}