1
0
Files
yel-dspace-angular/src/+app/+home/home.component.ts
2016-11-30 15:13:29 +01:00

28 lines
747 B
TypeScript

import { Component, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core';
import { ModelService } from '../shared/model/model.service';
@Component({
changeDetection: ChangeDetectionStrategy.Default,
encapsulation: ViewEncapsulation.Emulated,
selector: 'home',
styleUrls: [ './home.component.css' ],
templateUrl: './home.component.html'
})
export class HomeComponent {
data: any = {};
constructor(public model: ModelService) {
// we need the data synchronously for the client to set the server response
// we create another method so we have more control for testing
this.universalInit();
}
universalInit() {
this.model.get('/data.json').subscribe(data => {
this.data = data;
});
}
}