Created
December 2, 2025 09:51
-
-
Save debugmodedotnet/4b810c5489a855727807faa11be50bc9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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