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
689 B
27 lines
689 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-dairy',
|
|
templateUrl: './dairy.component.html',
|
|
styleUrls: ['./dairy.component.css']
|
|
})
|
|
export class DairyComponent implements OnInit {
|
|
|
|
products:Products[];
|
|
name:string;
|
|
|
|
constructor(private productsService:ProductsService, private route:Router) {
|
|
this.products=[];
|
|
this.name='Dairy';
|
|
}
|
|
|
|
ngOnInit(): void {
|
|
this.productsService.getProductsByCategory(this.name).subscribe(data=>{
|
|
this.products=data;
|
|
})
|
|
}
|
|
|
|
}
|