From GandalfLife, 1 Month ago, written in JavaScript.
Embed
  1. import { Component, OnInit } from '@angular/core';
  2. import { UserService } from '../../shared/user.service';
  3.  
  4. @Component({
  5.   selector: 'app-botinv',
  6.   templateUrl: './botinv.component.html',
  7.   styleUrls: ['./botinv.component.css']
  8. })
  9. export class BotinvComponent implements OnInit {
  10.  
  11.   constructor(private userService: UserService) { }
  12.  
  13.   ngOnInit() {
  14.   }
  15.  
  16.   get User(){
  17.         return this.userService;
  18.   }
  19.  
  20.   addItem(item){
  21.         //Check if item is already in, else add it
  22.         if(!this.userService.checkItemArrBot(item)){
  23.                 this.userService.addItemArrBot(item)
  24.         }
  25.   }
  26.  
  27.   removeItem(item){
  28.         if(this.userService.checkItemArrBot(item)){
  29.                 this.userService.removeItemArrBot(item)
  30.         }
  31.   }
  32. }