You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.2 KiB
43 lines
1.2 KiB
import { Component } from '@angular/core';
|
|
import { RouterOutlet } from '@angular/router';
|
|
import { HttpClientModule } from '@angular/common/http';
|
|
|
|
import { LoginComponent } from './components/login/login.component';
|
|
|
|
|
|
import { UserService } from './services/user-service';
|
|
import { User } from './models/user.model';
|
|
|
|
import { UserMenuComponent } from './components/user-menu/user-menu.component';
|
|
import { SudokuService } from "./services/sudoku-service"
|
|
import { UserAccueilComponent } from './components/user-accueil/user-accueil.component';
|
|
|
|
@Component({
|
|
selector: 'app-root',
|
|
standalone: true,
|
|
imports: [RouterOutlet, UserMenuComponent, HttpClientModule],
|
|
templateUrl: './app.component.html',
|
|
providers: [
|
|
UserService,
|
|
SudokuService
|
|
]
|
|
})
|
|
export class AppComponent {
|
|
title = 'angular-tp2-correct';
|
|
|
|
constructor(protected userService: UserService, protected sudokuService: SudokuService){ }
|
|
|
|
changeUserName($event: User): void {
|
|
this.userService.addToLocalStorage($event);
|
|
}
|
|
|
|
onActivate(componentRef: Event): void {
|
|
if(componentRef instanceof LoginComponent) {
|
|
componentRef.addConnectEvent.subscribe((connectedUser: User) => {
|
|
this.changeUserName(connectedUser);
|
|
});
|
|
}
|
|
|
|
}
|
|
}
|