Created
March 14, 2019 13:55
-
-
Save mdmoin7/8c95364c8bac0accc10e5abb3d80db3e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<app-product (addItem)="addDataToCart($event.product)" [pData]="product" ></app-product> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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