File

src/app/pages/dashboard/traffic/traffic.component.ts

Implements

OnDestroy

Metadata

selector ngx-traffic
styleUrls traffic.component.scss
template
<nb-card size="xsmall">
  <nb-card-header>
    <span>Traffic Consumption</span>
    <div class="dropdown ghost-dropdown" ngbDropdown>
      <button type="button" class="btn btn-sm" ngbDropdownToggle
              [ngClass]="{ 'btn-success': currentTheme == 'default', 'btn-primary': currentTheme != 'default'}">
        {{ type }}
      </button>
      <ul ngbDropdownMenu class="dropdown-menu">
        <li class="dropdown-item" *ngFor="let t of types" (click)="type = t">{{ t }}</li>
      </ul>
    </div>
  </nb-card-header>
  <nb-card-body class="p-0">
    <ngx-traffic-chart></ngx-traffic-chart>
  </nb-card-body>
</nb-card>

Index

Properties
Methods

Constructor

constructor(themeService: NbThemeService)
Parameters :
Name Type Optional
themeService NbThemeService no

Methods

ngOnDestroy
ngOnDestroy()
Returns : void

Properties

currentTheme
currentTheme: string
Type : string
themeSubscription
themeSubscription: any
Type : any
type
type: string
Type : string
Default value : 'month'
types
types: []
Type : []
Default value : ['week', 'month', 'year']
import { Component, OnDestroy } from '@angular/core';
import { NbThemeService } from '@nebular/theme';

@Component({
  selector: 'ngx-traffic',
  styleUrls: ['./traffic.component.scss'],
  template: `
    <nb-card size="xsmall">
      <nb-card-header>
        <span>Traffic Consumption</span>
        <div class="dropdown ghost-dropdown" ngbDropdown>
          <button type="button" class="btn btn-sm" ngbDropdownToggle
                  [ngClass]="{ 'btn-success': currentTheme == 'default', 'btn-primary': currentTheme != 'default'}">
            {{ type }}
          </button>
          <ul ngbDropdownMenu class="dropdown-menu">
            <li class="dropdown-item" *ngFor="let t of types" (click)="type = t">{{ t }}</li>
          </ul>
        </div>
      </nb-card-header>
      <nb-card-body class="p-0">
        <ngx-traffic-chart></ngx-traffic-chart>
      </nb-card-body>
    </nb-card>
  `,
})
export class TrafficComponent implements OnDestroy {
  type = 'month';
  types = ['week', 'month', 'year'];
  currentTheme: string;
  themeSubscription: any;

  constructor(private themeService: NbThemeService) {
    this.themeSubscription = this.themeService.getJsTheme().subscribe(theme => {
      this.currentTheme = theme.name;
    });
  }

  ngOnDestroy() {
    this.themeSubscription.unsubscribe();
  }
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""