Breeze / breeze-client

Breeze for JavaScript clients
MIT License
38 stars 16 forks source link

Example of DataServiceODataAdapter #19

Open Tiberriver256 opened 5 years ago

Tiberriver256 commented 5 years ago

Hi,

Is there a good example somewhere of using breeze-client@latest with the DataServiceODataAdapter?

Below is what I tried but got a lot of errors with:

constructor(http: HttpClient) {
    // the order is important
    ModelLibraryBackingStoreAdapter.register();
    UriBuilderODataAdapter.register();

    config.registerAdapter('ajax', <any>function() { return new AjaxHttpClientAdapter(http); });
    config.initializeAdapterInstance('ajax', AjaxHttpClientAdapter.adapterName, true);

    DataServiceODataAdapter.register();
}
Tiberriver256 commented 5 years ago

Specifically I'm trying to get a sample working with the OData v4 TripPin sample service: https://services.odata.org/TripPinRESTierService

steveschmitt commented 5 years ago

What were the errors?

Tiberriver256 commented 5 years ago
Error: Unable to initialize OData.  Needed to support remote OData services
    at Object.requireLib (breeze-client.js:545)
    at DataServiceODataAdapter.initialize (breeze-client-adapter-data-service-odata.js:62)
    at BreezeConfig._initializeAdapterInstanceCore (breeze-client.js:1582)
    at BreezeConfig.initializeAdapterInstance (breeze-client.js:1482)
    at Function.register (breeze-client-adapter-data-service-odata.js:59)
    at new AppComponent (app.component.ts:40)
    at createClass (core.js:27865)
    at createDirectiveInstance (core.js:27685)
    at createViewNodes (core.js:38315)
    at createRootView (core.js:38187)
steveschmitt commented 5 years ago

In addition to breeze, you will need the datajs library. It's not an npm package, and will need to be loaded by a Githubissues.

  • Githubissues is a development platform for aggregating issues.