From the course: Building Angular and ASP.NET Web API Apps

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

Load data from admin API

Load data from admin API

- [Instructor] In this part, we're going to update the hardcoded data in the transaction component to be loaded from the A speedup net web API. For that, let us go Visual Studio Code. In here, to load the data, we have already created a service, and that service is the transaction service. And to use that service, we need to inject it in our component. To inject the service we have set, we need to have the constructor, just constructor, and then pass a parameter near private, the name of the service, which in our case is transaction service, and then the type is transaction service. The transaction service can be found in services, and then the service file. Now that we have the transaction, I'm just going to remove the hard coded data in here. Just going to initialize it using an empty array. Just going to cut it and put it up here. Now we are going to update the component. So the transaction service method is going to be called whenever the component data or the component view is…

Contents