blob: 554b2ded174e0d00c35ccfafe9522ba39eccc4b4 [file] [log] [blame]
Matteo Scandolo43ffb672016-12-02 14:49:58 -08001/// <reference path="../../typings/index.d.ts"/>
2import {Component, OnInit} from '@angular/core';
Matteo Scandolo43ffb672016-12-02 14:49:58 -08003import {StyleConfig} from './config/style.config';
4import {CoreService} from './services/rest/core.service';
Matteo Scandolod819c922016-12-02 14:06:14 -08005
6@Component({
Matteo Scandolo43ffb672016-12-02 14:49:58 -08007 selector: 'xos-app',
8 template: require('./hello.html'),
9 providers: [CoreService],
Matteo Scandolod819c922016-12-02 14:06:14 -080010})
Matteo Scandolo5e5c12b2016-12-05 16:17:52 -080011export class HelloComponent implements OnInit {
Matteo Scandolod819c922016-12-02 14:06:14 -080012
Matteo Scandolo43ffb672016-12-02 14:49:58 -080013 // declare class properties
14 public hello: string;
15 public endpoints: any[];
16
17 constructor(private coreService: CoreService) {
18 this.hello = `Hello ${StyleConfig.projectName}!`;
19 this.endpoints = [];
20 }
21
22 ngOnInit() {
23 console.log('on init');
24 this.coreService.getCoreEndpoints()
25 .subscribe(
26 endpoints => {
Matteo Scandolo5e5c12b2016-12-05 16:17:52 -080027 this.endpoints = endpoints;
Matteo Scandolo43ffb672016-12-02 14:49:58 -080028 },
29 err => console.log
Matteo Scandolo5e5c12b2016-12-05 16:17:52 -080030 );
Matteo Scandolod819c922016-12-02 14:06:14 -080031 }
32}