Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bkardol/angular-odata
https://github.com/bkardol/angular-odata
angular angular6 angular7 odata odata-client typescript
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/bkardol/angular-odata
- Owner: bkardol
- License: mit
- Created: 2019-03-26T21:32:05.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-03-31T20:44:49.000Z (over 5 years ago)
- Last Synced: 2024-12-12T14:17:33.362Z (10 days ago)
- Topics: angular, angular6, angular7, odata, odata-client, typescript
- Language: TypeScript
- Size: 165 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# 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:
```javascript
export class MyODataConfig extends ODataConfig {
rootURL = 'https://services.odata.org/TripPinRESTierService';
}
``````javascript
providers: [
{ provide: ODataConfig, useClass: MyODataConfig }
],
imports: [
AngularODataModule
]
```# Usage example
```javascript
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("artists");
// Retrieve all artists and log the artists to the console.
artistsService.query().getCollection().subscribe(artists => console.log(artists));
}
}
```Visit the [wiki](https://github.com/Snorvisable/angular-odata/wiki) if you want to know more.