Skip to content

ODataFactory

Bart Kardol edited this page Mar 31, 2019 · 2 revisions

ODataFactory

With the ODataFactory you can create an ODataService. This ODataFactory can be injected in a constructor.

export class AppComponent implements OnInit {
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));
  }
}
Clone this wiki locally