Angular - State Management
Given this service code, what will the console log after calling
increment() twice?import { Injectable, signal } from '@angular/core';
@Injectable({ providedIn: 'root' })
export class CounterService {
count = signal(0);
increment() {
this.count.update(c => c + 1);
}
}
const service = new CounterService();
service.increment();
service.increment();
console.log(service.count());