Video Transcript
00:01
This is the initial implementation of the
NGRIX Signal Store in our application.
I convert the domain setting service to NGRIX Signal Store,
which provided in root because it used globally.
For the ones which needs just be injected
in one place and used in one place,
it would be enough to have not the root implementation.
00:26
Also here we have the call state,
which represent the different call states for our collections.
As we can see here,
we have the settings and status collection.
The with state provides us default state,
which lays in this constant
and represents the interface for implementation
of the state and the default state itself.
00:51
All the files you can see here in the shared folder store.
Under the specific name of the current feature,
it is the main.
Also with DevTools provides the key for
our Redux DevTools in the Chrome extension.
So it calls the main settings store.
So if you need any information regarding that store,
you could find out it by this name.
01:21
Also Signal Store provide us two methods.
Which are...
Implements by the RixJS method.
Which just called the...
Just a wrapper for the regular RixJS call.
So here as a base thing,
after the call we are setting the...
01:45
If this asynchronous call,
we need to understand the state of that call.
We need to have the...
First of all update of the set to this call to loading.
Which
change it to...
For the collection settings to loading.
02:01
Then we have two versions of the...
That call.
If it is success or it is an error.
For the success we are getting the action loading setting success.
And set this state to loaded.
Otherwise for error state we have the...
For action is loaded settings error.
02:25
And the set error method which set the...
For collection the settings.
Set the this error.
Same for the load status here.
Set loading.
Call the method.
Update it in the positive scenario.
02:43
And set an error in the negative scenario.
Otherwise for getting the expected updates for the...
One of the collection.
We could do it by method like this.
Update the settings.
So we have the partial implementation of the...
We have the changes as a partial of the corporate settings class.
03:11
And we could just take by spread operator.
We could take the existing values and change it by the new ones.
And then export this...
Methods at the top.
Also we have the...
This computed here.
Which represent the...
03:30
Computer signals.
And allow us to use it across the application to first of all...
Not allow to mutate these values.
And second of all is...
Just a shorter version of what we want to use.
And here we also could put some logic like here.
So we...
03:51
We don't need to...
Have it in all the places where we need to use it.
Also we have such a thing as an action.
Actions.
Which allow us to understand which actions this store implements.
And we should call it...
Depends on place where we call it.
04:11
Not call it but use it for the methods.
Inside the methods in update state function as a second parameter.
Related videos
Purple Flower
Discover timelapse of the aesthetically pleasing video of growing...
Google Stitch – The New AI-Powered UI Design Tool...
Meet Google Stitch, the new AI-powered UI design tool that's set to...
Light Pink Flower
Discover timelapse of the aesthetically pleasing video of growing...