File

src/app/analysis/equipment/equipment.component.ts

Implements

OnInit

Metadata

selector app-equipment
styleUrls ./equipment.component.scss
templateUrl ./equipment.component.html

Index

Properties
Methods

Constructor

constructor(_service)
Parameters :
Name Optional
_service No

Methods

brands
brands()
Returns : void
ngOnInit
ngOnInit()
Returns : void
operators
operators()
Returns : void

Properties

brand_data
Type : any
Default value : []
operator_data
Type : any
Default value : []
import { Component, OnInit, Inject } from '@angular/core';

@Component({
  selector: 'app-equipment',
  templateUrl: './equipment.component.html',
  styleUrls: ['./equipment.component.scss']
})
export class EquipmentComponent implements OnInit {
  brand_data: any = [];
  operator_data: any = [];

  constructor(@Inject('AnalysisService') private _service) {}

  ngOnInit() {
    this._service.crowdDevice();
    this.brands();
    this.operators();
  }

  operators() {
    this._service.crowdDevice$.subscribe(res => {
      if (res.datas) {
        console.log(res.datas.operators);
        res.datas.operators.map(item => {
          this.operator_data.push({
            name: item.attrName,
            value: (item.attrValue * 100).toFixed(2)
          });
        });
      }
    });
  }

  brands() {
    this._service.crowdDevice$.subscribe(res => {
      if (res.datas) {
        res.datas.brand.list.map(item => {
          this.brand_data.push({
            name: item.attrName,
            value: (item.attrValue * 100).toFixed(2)
          });
        });
      }
    });
  }
}
<div fxLayout="row wrap">
  <div fxFlex.gt-sm="60">
    <analysis-equipment-brand [data]="brand_data"></analysis-equipment-brand>
  </div>
  <div fxFlex.gt-sm="40">
    <analysis-crowd-operators [data]="operator_data"></analysis-crowd-operators>
  </div>
</div>

./equipment.component.scss

mat-card {
  margin: 5px;
  padding: 0;
}

mat-card-title {
  padding: 16px 24px;
}

mat-card-content {
  min-height: 400px;
}
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""