Created
May 27, 2020 21:52
-
-
Save Qarun-Qadir-Bissoondial/85208cf868f89ee4daa551e3ff121cf4 to your computer and use it in GitHub Desktop.
Simple inventory component
This file contains 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
import { Component, OnInit } from '@angular/core'; | |
import { InventoryService } from '../inventory.service'; | |
@Component({ | |
selector: 'app-inventory', | |
template: './inventory.component.html', | |
styleUrls: ['./inventory.component.scss'] | |
}) | |
export class InventoryComponent implements OnInit { | |
count: number; | |
constructor(private inventory: InventoryService) { | |
this.count = this.inventory.inventoryCount; | |
} | |
ngOnInit(): void { | |
} | |
increment() { this.inventory.incrementCount(); this.count = this.inventory.inventoryCount; } | |
decrement() { this.inventory.decrementCount(); this.count = this.inventory.inventoryCount; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment