@snorvisable/angular-odata
TypeScript icon, indicating that this package has built-in type declarations

0.2.2 • Public • Published

AngularOdata

This library exposes a service for easy communication with OData endpoints. Use it to retrieve and manipulate data through OData endpoints.

Quick set-up

  1. Add @snorvisable/angular-odata to the dependencies in the project.json file. "@snorvisable/angular-odata": "0.2.2"
  2. Import the AngularODataModule in app.module.ts.
  3. Create a new class extending ODataConfig and add it to the providers. Replace rootUrl with the root url of the API you'd like to query:
export class MyODataConfig extends ODataConfig {
  rootURL = 'https://services.odata.org/TripPinRESTierService';
}
providers: [
    { provide: ODataConfig, useClass: MyODataConfig }
  ],
imports: [
    AngularODataModule
  ]

Usage example

export class AppComponent implements OnInit {
  title = 'My Awesome App';
constructor(private factory: ODataFactory) {

}

  ngOnInit(): void {
    // Create a service with the injected factory.
    const artistsService = this.factory.CreateService<Artist>("artists");
    
    // Retrieve all artists and log the artists to the console.
    artistsService.query().getCollection().subscribe(artists => console.log(artists));
  }
}

Visit the wiki if you want to know more.

Readme

Keywords

Package Sidebar

Install

npm i @snorvisable/angular-odata

Weekly Downloads

0

Version

0.2.2

License

MIT

Unpacked Size

326 kB

Total Files

36

Last publish

Collaborators

  • snorvisable