Ahlushko

Untitled

Jun 16th, 2020
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { Injectable } from '@angular/core';
  2. import { MongoService} from 'wacom'
  3. @Injectable({
  4.     providedIn: 'root'
  5. })
  6. export class CompService {
  7.     public comp:any = []
  8.     public _comp:any = {}
  9.     public summ:number = 0
  10.     constructor(
  11.         private mongo: MongoService,
  12.         ) {
  13.         this.mongo.get('comp', {}, (arr, obj) => {
  14.             this.comp = arr
  15.             this._comp = obj
  16.             arr.forEach(numb => {
  17.                 this.summ += numb.number
  18.             })
  19.         })
  20.     }
  21.     create(pc) {
  22.         this.mongo.create('comp', pc)
  23.     }
  24.     delete(pc = 0) {
  25.         this.mongo.delete('comp', pc)
  26.     }
  27.     update(pc) {
  28.         this.mongo.update('comp', pc)
  29.     }
  30. }
Add Comment
Please, Sign In to add comment