Dorababu M
asked on
ngrx how to get the stroed value from selector instead of observable
Hello I have the following code where I am trying to store a value to store and get it I have created a sample code for the same
https://stackblitz.com/edit/stackblitz-starters-rfqf6h?file=src%2Fapp%2Fapp.component.ts
I have created the following store
action.ts
import { createAction, props } from '@ngrx/store';
export const setTrackLength = createAction(
'[Track] Set Value',
props<{ lengthOfTrack: number }>()
);
selector.ts
import { createFeatureSelector, createSelector } from '@ngrx/store';
import { TrackState } from './track.state';
export const setTrackLength = createFeatureSelector<TrackState>('trackState');
export const getTrackLength = createSelector(
setTrackLength,
(state) => state.trackLength
);
am storing and getting the value but it display as follows where I need the value to be 1
In the console I can see the value as per the second image I need that value to be read instead of entire observale
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.