Skip to content

Instantly share code, notes, and snippets.

@mdmoin7
Created March 14, 2019 13:55
Show Gist options
  • Save mdmoin7/8c95364c8bac0accc10e5abb3d80db3e to your computer and use it in GitHub Desktop.
Save mdmoin7/8c95364c8bac0accc10e5abb3d80db3e to your computer and use it in GitHub Desktop.
<app-product (addItem)="addDataToCart($event.product)" [pData]="product" ></app-product>
export class ProductComponent implements OnInit {
@Input() pData: Product = null;
@Output() addItem = new EventEmitter();
constructor() { }
ngOnInit() { }
addToCart() {
// send data to parent
this.addItem.emit({ product: this.pData });
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment