Closed amrit-moomie closed 5 months ago
Yes, of course, just do:
export const TabStore = signalStore(
{ providedIn: 'root' },
withState<XYZ>(XYZSTATE),
withMethods((store) => {
const markStateDirtyForId = () => {
// implement your function here
};
return {
markStateDirtyforId,
openId: (id) => {
markStateDirtyforId(id);
}
}
})
)
An alternative would be:
export const TabStore = signalStore(
{ providedIn: 'root' },
withState<XYZ>(XYZSTATE),
withMethods((store) => {
return {
markStateDirtyforId() {
// your implementation here
}
};
}),
withMethods((store) => {
return {
openId: (id) => {
store.markStateDirtyforId(id);
}
}
})
)
Amazing
Is it possible to call a method in the store from another method in the same store?
Like example, I am not able to. I will get an error on Line 9 like
Property 'markStateDirtyforId' does not exist on type.....