Project

General

Profile

1 50002 myrto.kouk
/**
2
 * Created by myrto on 11/24/17.
3
 */
4
5 50216 myrto.kouk
import {Component, OnInit} from '@angular/core';
6 50170 myrto.kouk
import {PiwikInfo} from '../../domain/typeScriptClasses';
7
import {ActivatedRoute} from '@angular/router';
8 50432 myrto.kouk
import { PiwikService } from '../../services/piwik.service';
9 49993 myrto.kouk
10
@Component ({
11 50002 myrto.kouk
  selector: 'app-metrics-instructions',
12
  templateUrl: 'metrics-instructions.component.html'
13 49993 myrto.kouk
})
14
15 50002 myrto.kouk
export class MetricsInstructionsComponent implements OnInit {
16 50216 myrto.kouk
  piwik: PiwikInfo;
17
  errorMessage: string;
18 49993 myrto.kouk
19 50170 myrto.kouk
  constructor(
20
    private route: ActivatedRoute,
21 50432 myrto.kouk
    private piwikService: PiwikService
22 50170 myrto.kouk
  ) {}
23 49993 myrto.kouk
24 50170 myrto.kouk
  ngOnInit() {
25
    this.getPiwik();
26
  }
27
28
  getPiwik(): void {
29
    let id = this.route.snapshot.paramMap.get('id');
30 50432 myrto.kouk
    this.piwikService.getPiwikInfo(id).subscribe(
31 50170 myrto.kouk
      piwik => this.piwik = piwik,
32 50303 myrto.kouk
      error => console.log(error)
33 50170 myrto.kouk
    );
34
  }
35
36 49993 myrto.kouk
}