Home > Net >  Understanding a download routing in Angular
Understanding a download routing in Angular

Time:12-31

I'm starting to learn Angular and I have to discover within an application how an address is being routed to generate the download of a file that must be requested to the backend and that is in a database. After a window.open command, I have no idea what happens. The url does not point to any file. Can anyone give me a hint of what to look for to get to where the frontend asks the backend for the file? I've read a bit about routing, but there are so many files in the application related to routing that I'm quite confused. As I have little time to understand the paths that the program follows to make this download, I ask for some help here. Thanks for any tip.

I read about routing, but it wasn't enough to find out what happens when that url is used in the window.open method.

CodePudding user response:

Normally the HttpRequests are all located in one of the services, usually by the name [fill what service is].service.ts. Angular uses HttpClientModule and provides a HttpClient to help structure your Http requests. I think if you were able to show an example of your problem you would have had a solution pretty fast. Next time give an example!

CodePudding user response:

I discovered that my Asp .NET controller class has an attributte "Route" that relate the controller to the url used in the frontend to navigate to the backend on the server. When a request is done to the address routed to the controller, a method with the attributte [Http_Get] or [Http_Post] is called in the controller to process the parameters in the url of the request. Then the file is returned to the frontend begins the download.

  • Related