I'm really new to angular and this is the first project I'm creating. what I need to do here is create an add-editClient component and use the angular resolve method to get data from the backend which is spring-boot and for the database I use MYSQL with DBeaver. I design my interface with angular material.
I added resolve data in the app-routing module as well. no matter how many times I try to install resolve from @angular/router it still gets deprecated.
please see the attached images below.
addEditClient.ts file app-routing.module.ts
please let me know if there is any way to solve this problem. any suggestions are much appreciated :)
Resolve was deprecated in v15.2
And will be removed in v17
As mentioned in the deprecation note of
Resolvein@angular/routerit was deprecated in favor ofResolveFn.Steps to use the functional resolvers
Remove the deprecated
Resolveimplementation from theaddEditClient.tsAdd this function to your router or the service file or any other file with
export. This will inject theAddEditClientServiceand resolve the function you need. As you can see you can also use therouteandstateparams and pass them to your function.And use it in the router path
Or with a shorter approach by using the function directly in Route object
You can checkout more about this in the Angular documentation