2019-09-27 16:10:03 +02:00
|
|
|
import {Component} from '@angular/core';
|
2019-12-31 19:08:50 +01:00
|
|
|
import {TranslateService} from '@ngx-translate/core';
|
|
|
|
import {Router} from '@angular/router';
|
2019-08-09 13:38:51 +02:00
|
|
|
|
|
|
|
@Component({
|
2019-09-27 16:10:03 +02:00
|
|
|
selector: 'app-root',
|
|
|
|
templateUrl: './app.component.html',
|
|
|
|
styleUrls: ['./app.component.scss']
|
2019-08-09 13:38:51 +02:00
|
|
|
})
|
|
|
|
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
|
|
|
|
};
|
2019-12-31 19:08:50 +01:00
|
|
|
private step: string;
|
2019-10-01 15:43:37 +02:00
|
|
|
|
2019-12-31 19:08:50 +01:00
|
|
|
constructor(private translate: TranslateService,
|
|
|
|
private route: Router) {
|
2019-10-01 15:43:37 +02:00
|
|
|
this.translate.setDefaultLang('fr');
|
2019-12-31 19:08:50 +01:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2019-08-09 13:38:51 +02:00
|
|
|
}
|