Something went wrong. Try again.
Some angular code i wrote while following: Angular - The Complete Guide (2025 Edition)
Something went wrong. Try again.
1234567891011121314151617181920212223242526import { Injectable, signal } from '@angular/core';
import { Permission } from './auth.model';
@Injectable({ providedIn: 'root',})export class AuthService { activePermission = signal<Permission>('guest');
authenticate(email: string, password: string) { console.log(email, password); if (email === 'admin' && password === 'admin') { this.activePermission.set('admin'); } else if (email === 'user' && password === 'user') { this.activePermission.set('user'); } else { this.activePermission.set('guest'); } }
logout() { this.activePermission.set('guest'); }}