
Daniel Acero
Preguntabuenos dias intente modularizar el componente products pero no me esta trayendo los datos del servicio, me aparece el siguiente error, he estado mirando los archivos de la clase pero no logro resolverlo
products.module.ts
<code> import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { ProductComponent } from './components/product/product.component'; import { ProductDetailComponent } from './components/product-detail/product-detail.component'; import { ProductsComponent } from './components/products/products.component'; import { ShareModule } from '../share/share.module'; import { ProductsRoutingModule } from './products-routing.module'; import { CoreModule } from '../core/core.module'; @NgModule({ declarations: [ ProductComponent, ProductDetailComponent, ProductsComponent ], imports: [ CommonModule, ShareModule, ProductsRoutingModule ], exports: [ ] }) export class ProductsModule { }
products.component.ts
<code> import { Component, OnInit } from '@angular/core'; import { Product } from './../../../core/model/product.model'; @Component({ selector: 'app-products', templateUrl: './products.component.html', styleUrls: ['./products.component.scss'] }) export class ProductsComponent implements OnInit { products: Product[] = [ { id: '1', image: 'assets/IMG/camiseta.png', title: 'Camiseta', price: 80000, description: 'bla bla bla bla bla' }, { id: '2', image: 'assets/IMG/hoodie.png', title: 'Hoodie', price: 80000, description: 'bla bla bla bla bla' }, { id: '3', image: 'assets/IMG/mug.png', title: 'Mug', price: 80000, description: 'bla bla bla bla bla' }, { id: '4', image: 'assets/IMG/pin.png', title: 'Pin', price: 80000, description: 'bla bla bla bla bla' }, { id: '5', image: 'assets/IMG/stickers1.png', title: 'Stickers', price: 80000, description: 'bla bla bla bla bla' }, { id: '6', image: 'assets/IMG/stickers2.png', title: 'Stickers', price: 80000, description: 'bla bla bla bla bla' } ]; constructor() {} ngOnInit() {} clickProduct(id: number) { console.log('product id : ' + id); } }
product.component.ts
<code> import { Component, OnInit, Input, Output, EventEmitter, OnDestroy } from '@angular/core'; import { Product } from './../../../core/model/product.model'; @Component({ selector: 'app-product', templateUrl: './product.component.html', styleUrls: ['./product.component.scss'] }) export class ProductComponent implements OnInit, OnDestroy { @Input() product: Product; @Output() productClicked: EventEmitter<any> = new EventEmitter(); today = new Date(); constructor() { console.log('1 constructor'); } ngOnInit() { console.log(this.product); } ngOnDestroy() { console.log('5 ngOnDestroy'); } addCart() { console.log('agregar al carrito'); this.productClicked.emit(this.product.id); } }

Daniel Acero
lo resolvi restaurando el proyecto al commit anterior y genere nuevamente el módulo, aún quede con la intriga de cual era el error, tal vez se algo con las rutas de los servicios pero bueno lo importante es que puedo seguir con el curso y no seguir estancado en ese error