Getting Started with the Resource API in Angular- Video

Angular 19 will introduce a new reactive API called Resource API. The primary purpose of the Resource API is to load the resources, such as:

  • Fetch data from the API
  • Update data locally
  • Asynchronously load local resource
  • It should not be used for mutation such as POST operations.

It should mainly be used to load data from the API using the HTTP protocol. You can create a straightforward resource as shown below:


export class AppComponent {

  productResource = resource({
    loader: async () => {
      return Promise.resolve({ name: 'Book', price: 100 });
    }
  })

}

By default, the loader function returns the promise, and you can read the value on the template below:

Read full article here – https://www.telerik.com/blogs/getting-started-resource-api-angular

You can watch a detailed video on the same here –


Discover more from Dhananjay Kumar

Subscribe to get the latest posts sent to your email.

Published by Dhananjay Kumar

Dhananjay Kumar is founder of NomadCoder and ng-India

Leave a comment

Discover more from Dhananjay Kumar

Subscribe now to keep reading and get access to the full archive.

Continue reading