Skip to content

Instantly share code, notes, and snippets.

@Qarun-Qadir-Bissoondial
Created May 27, 2020 21:52
Show Gist options
  • Save Qarun-Qadir-Bissoondial/85208cf868f89ee4daa551e3ff121cf4 to your computer and use it in GitHub Desktop.
Save Qarun-Qadir-Bissoondial/85208cf868f89ee4daa551e3ff121cf4 to your computer and use it in GitHub Desktop.
Simple inventory component
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