funky-framadate-front/src/app/app.component.ts

45 lines
1.0 KiB
TypeScript
Raw Normal View History

2019-09-27 16:10:03 +02:00
import {Component} from '@angular/core';
import {TranslateService} from '@ngx-translate/core';
import {Router} from '@angular/router';
@Component({
2019-09-27 16:10:03 +02:00
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
2019-09-27 16:10:03 +02:00
title = 'framadate';
//translation demo:
minutes = 12;
2019-10-01 15:43:37 +02:00
user = {
name: 'Arthur',
age: 42
};
private step: string;
2019-10-01 15:43:37 +02:00
constructor(private translate: TranslateService,
private route: Router) {
2019-10-01 15:43:37 +02:00
this.translate.setDefaultLang('fr');
this.route.events.subscribe((event: any) => {
// console.log('event', event);
if (event.url) {
const tab = event.url.split('/');
console.log(tab);
if (tab && tab[2]) {
this.step = tab[2];
} else {
this.step = 'home';
}
}
});
2019-10-01 15:43:37 +02:00
}
switchLanguage(language: string) {
this.translate.use(language);
}
}