auth.service.ts
angular/examples/week05-06/src/app/auth.service.ts
// @ts-nocheck
import { Injectable, signal } from '@angular/core';
@Injectable({ providedIn: 'root' })
export class AuthService {
private authenticated = signal(false);
isAuthenticated(): boolean {
return this.authenticated();
}
login(): void {
this.authenticated.set(true);
}
logout(): void {
this.authenticated.set(false);
}
}
Articles liés
server.js
server.js — javascript source code from the angular learning materials (angular/comprehensive-demo/server/server.js).
Lire l'article →app.component.ts
app.component.ts — typescript source code from the angular learning materials (angular/comprehensive-demo/src/app/app.component.ts).
Lire l'article →app.config.ts
app.config.ts — typescript source code from the angular learning materials (angular/comprehensive-demo/src/app/app.config.ts).
Lire l'article →app.routes.ts
app.routes.ts — typescript source code from the angular learning materials (angular/comprehensive-demo/src/app/app.routes.ts).
Lire l'article →auth.guard.ts
auth.guard.ts — typescript source code from the angular learning materials (angular/comprehensive-demo/src/app/core/guards/auth.guard.ts).
Lire l'article →role.guard.ts
role.guard.ts — typescript source code from the angular learning materials (angular/comprehensive-demo/src/app/core/guards/role.guard.ts).
Lire l'article →