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'; |
| 3 | import {NgFor} from '@angular/common'; |
| 4 | import {StyleConfig} from './config/style.config'; |
| 5 | import {CoreService} from './services/rest/core.service'; |
Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 6 | |
| 7 | @Component({ |
Matteo Scandolo | 43ffb67 | 2016-12-02 14:49:58 -0800 | [diff] [blame^] | 8 | selector: 'xos-app', |
| 9 | template: require('./hello.html'), |
| 10 | providers: [CoreService], |
Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 11 | }) |
| 12 | export class HelloComponent { |
Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 13 | |
Matteo Scandolo | 43ffb67 | 2016-12-02 14:49:58 -0800 | [diff] [blame^] | 14 | // declare class properties |
| 15 | public hello: string; |
| 16 | public endpoints: any[]; |
| 17 | |
| 18 | constructor(private coreService: CoreService) { |
| 19 | this.hello = `Hello ${StyleConfig.projectName}!`; |
| 20 | this.endpoints = []; |
| 21 | } |
| 22 | |
| 23 | ngOnInit() { |
| 24 | console.log('on init'); |
| 25 | this.coreService.getCoreEndpoints() |
| 26 | .subscribe( |
| 27 | endpoints => { |
| 28 | this.endpoints = endpoints |
| 29 | }, |
| 30 | err => console.log |
| 31 | ) |
Matteo Scandolo | d819c92 | 2016-12-02 14:06:14 -0800 | [diff] [blame] | 32 | } |
| 33 | } |