Matteo Scandolo | 43ffb67 | 2016-12-02 14:49:58 -0800 | [diff] [blame] | 1 | /// <reference path="../../typings/index.d.ts"/> |
| 2 | import {Component, OnInit} from '@angular/core'; |
Matteo Scandolo | 43ffb67 | 2016-12-02 14:49:58 -0800 | [diff] [blame] | 3 | import {StyleConfig} from './config/style.config'; |
| 4 | import {CoreService} from './services/rest/core.service'; |
Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 5 | |
| 6 | @Component({ |
Matteo Scandolo | 43ffb67 | 2016-12-02 14:49:58 -0800 | [diff] [blame] | 7 | selector: 'xos-app', |
| 8 | template: require('./hello.html'), |
| 9 | providers: [CoreService], |
Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 10 | }) |
Matteo Scandolo | 5e5c12b | 2016-12-05 16:17:52 -0800 | [diff] [blame^] | 11 | export class HelloComponent implements OnInit { |
Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 12 | |
Matteo Scandolo | 43ffb67 | 2016-12-02 14:49:58 -0800 | [diff] [blame] | 13 | // 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 Scandolo | 5e5c12b | 2016-12-05 16:17:52 -0800 | [diff] [blame^] | 27 | this.endpoints = endpoints; |
Matteo Scandolo | 43ffb67 | 2016-12-02 14:49:58 -0800 | [diff] [blame] | 28 | }, |
| 29 | err => console.log |
Matteo Scandolo | 5e5c12b | 2016-12-05 16:17:52 -0800 | [diff] [blame^] | 30 | ); |
Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 31 | } |
| 32 | } |