Advertisement
Guest User

Untitled

a guest
Apr 30th, 2018
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. import { Component, OnInit, VERSION, ViewEncapsulation } from '@angular/core';
  4. import { HttpErrorResponse } from '@angular/common/http';
  5. import { routerTransition } from '../../router.animations';
  6. import { QueToDesignService } from './que-to-design.service';
  7.  
  8. @Component({
  9.   selector    : 'app-design',
  10.   templateUrl : './que-to-design.component.html',
  11.   styleUrls   : ['./que-to-design.component.scss'],
  12.   animations  : [ routerTransition() ],
  13.   providers   : [ QueToDesignService ],
  14.   encapsulation : ViewEncapsulation.None
  15. })
  16.  
  17. export class QueToDesignComponent implements OnInit {
  18.  
  19.   // Init Variables
  20.   newSales : any;
  21.   newSalesTime : any;
  22.  
  23.   nodes = [
  24.       {
  25.           id: 1,
  26.           name: '3 Units',
  27.           children: [
  28.                 { id: 2, name: 'HGR 234 GP' },
  29.                 { id: 3, name: 'CA 987 - 896' },
  30.                 { id: 4, name: 'ND 987 - 123' }
  31.           ],
  32.           className: 'root1Class',
  33.       },
  34.   ];
  35.  
  36.   options = {
  37.       allowDrag: true,
  38.       animateSpeed: 30,
  39.       animateAcceleration: 1.2
  40.   };
  41.  
  42.   constructor( private service: QueToDesignService) {
  43.   }
  44.  
  45.   ngOnInit() {
  46.       this.service.getSalesData()
  47.           .subscribe(
  48.               data => {
  49.                   this.newSales = data.obj;
  50.               },
  51.               (err: HttpErrorResponse) => {
  52.                   if (err.error instanceof Error) {
  53.                       console.log('An error occurred:', err.error.message);
  54.                   } else {
  55.                       console.log(`Backend returned code ${err.status}, body was: ${err.error}`);
  56.                       console.log( JSON.stringify( err.error ) );
  57.                   }
  58.               }
  59.           );
  60.   }
  61.  
  62.   configureJob(){}
  63.  
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement