1
0

added initial home page content

This commit is contained in:
Art Lowel
2017-05-18 15:02:33 +02:00
parent e5a885afe7
commit f5e5b72f47
14 changed files with 107 additions and 54 deletions

View File

@@ -3,7 +3,6 @@ import {
ChangeDetectionStrategy,
Inject,
ViewEncapsulation,
OnDestroy,
OnInit, HostListener
} from "@angular/core";
import { TranslateService } from "ng2-translate";
@@ -11,7 +10,7 @@ import { HostWindowState } from "./shared/host-window.reducer";
import { Store } from "@ngrx/store";
import { HostWindowResizeAction } from "./shared/host-window.actions";
import { GLOBAL_CONFIG, GlobalConfig } from '../config';
import { EnvConfig, GLOBAL_CONFIG, GlobalConfig } from '../config';
@Component({
changeDetection: ChangeDetectionStrategy.Default,
@@ -20,15 +19,7 @@ import { GLOBAL_CONFIG, GlobalConfig } from '../config';
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnDestroy, OnInit {
private translateSubscription: any;
example: string;
data: any = {
greeting: 'Hello',
recipient: 'World'
};
export class AppComponent implements OnInit {
constructor(
@Inject(GLOBAL_CONFIG) public EnvConfig: GlobalConfig,
@@ -42,15 +33,9 @@ export class AppComponent implements OnDestroy, OnInit {
}
ngOnInit() {
this.translateSubscription = this.translate.get('example.with.data', { greeting: 'Hello', recipient: 'DSpace' }).subscribe((translation: string) => {
this.example = translation;
});
}
ngOnDestroy() {
if (this.translateSubscription) {
this.translateSubscription.unsubscribe();
}
const env: string = EnvConfig.production ? "Production" : "Development";
const color: string = EnvConfig.production ? "red" : "green";
console.info(`Environment: %c${env}`, `color: ${color}; font-weight: bold;`);
}
@HostListener('window:resize', ['$event'])