Skip to content

Instantly share code, notes, and snippets.

@debugmodedotnet
Created December 2, 2025 09:51
Show Gist options
  • Select an option

  • Save debugmodedotnet/4b810c5489a855727807faa11be50bc9 to your computer and use it in GitHub Desktop.

Select an option

Save debugmodedotnet/4b810c5489a855727807faa11be50bc9 to your computer and use it in GitHub Desktop.
import { computed, Injectable, signal } from '@angular/core';
@Injectable({
providedIn: 'root',
})
export class Productstore {
private _count = 0;
private CountSignal = signal(this._count);
Count = computed(()=>{
return this.CountSignal();
})
incrementCount() {
this.CountSignal.update((count) => count + 1);
}
decrementCount() {
this.CountSignal.update((count) => count - 1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment