Loading...
Loading...
ALWAYS use when implementing Angular state management with NgRx, including Store, Effects, Entity, and Signal Store.
npx skill4agent add oguzhan18/angular-ecosystem-skills ngrxwithEntities@ngrx/dataimport { signalStore, withState, withMethods, withHooks } from '@ngrx/signals';
export const AuthStore = signalStore(
withState({ user: null, isAuthenticated: false }),
withMethods((store, authService = inject(AuthService)) => ({
login(credentials: Credentials) {
authService.login(credentials).pipe(
tap(user => store.user.set(user))
).subscribe();
}
})),
withHooks({
onInit() {
// Initialize store
}
})
);import { createEntityAdapter, EntityState } from '@ngrx/entity';
export interface Product extends EntityState<Product> {
// Additional state properties
}
export const adapter = createEntityAdapter<Product>({
selectId: (product) => product.id
});ChangeDetectionStrategy.OnPush