injectStore
Signature
injectStore(): Storevaldres-angular Access the current store instance
Injects the current valdres store from the Angular dependency injection system. Useful for imperative operations.
Usage
import { Component } from "@angular/core"
import { injectStore } from "valdres-angular"
@Component({
selector: "app-debug",
template: `<button (click)="logValue()">Log value</button>`,
})
export class DebugComponent {
private store = injectStore()
logValue() {
console.log("Current:", this.store.get(myAtom))
}
}
See also
- provideValdres — setup valdres in Angular
- store — create a store instance