Add to project
Last updated
Last updated
The application migrated by WebMap generates the Angular components for the forms, to create and include the demo in the sample repository, you need to copy these files
Add a folder (use a meaningful name) with the files in the repository folder "src/app".
Next, you need to add the Angular Component, for this, import the .ts file into "app.module" and include it in the "entryComponents" and "declarations".
In the "CoreServices" folder we have three files:
SampleServices: Extends the WebMapService class of the Angular Client and provides access to the WebMap application and handles the API requests.
SampleApp: Extends the AngularApp class of the Angular Client and implements the Angular version of the WebMap Core Application.
mock-http: Implements the IService interface of WebMap Core and handles the POST requests.
You probably need to add some response for the request or API calls, so you need to mock this responses.
It is not necessary to create them from scratch, you must take advantage of the ones generated by the same backend in the application you migrated, to do this you must open DevTools and go to the network panel, you can copy everything you need and store it in json files in the assets/api folder.
Once you have the application, you only have to intercept the requests. To do this you must do the following:
In the "APIs.ts" file you will have to add the URL of the request and the path to the file with the response, in addition to the "getResponse" method, you can be guided by those of the other examples.
In case you have to respond to an API call you can do it from the SampleServices.ts file, the process is very similar and you can be guided by those of other examples, you only need the URL of the request and the path to the file with the response.