A bridge that configures Breeze to work with Angular out of the box.
This package is effectively obsolete. For Angular 4.3 and up it is recommended to use the new HttpClient service. An updated bridge which uses the HttpClient can be found here.
- Restructed package and minor code tweaks
- Update to to support Angular 4
- Update to breeze-client 1.6.3
- Renamed package to
breeze-bridge-angular
and synchronzied major/minor version with Angular - Renamed
BreezeBridgeAngular2Module
toBreezeBridgeAngularModule
- Renamed
AjaxAngular2Adapter
toAjaxAngularAdapter
- Export AjaxAngular2Adapter class, making it easier to add auth headers.
- Fix error response payload not being passed up
- Removed post install scripts from package.json
- Update to Angular 2 final
- Add support for AoT compilation
- Fix errant rejected promise in failure case
- The Breeze Angular bridge is no longer an injectable service. It has been changed to an NgModule
- Breeze client npm package 1.6.3 or higher
- Angular 2.0.0 or higher
-
Install breeze-client
npm install breeze-client --save
-
Install breeze-bridge-angular
npm install breeze-bridge-angular --save
A comprehensive example app that makes use of the bridge can be found here: https://github.com/Breeze/temphire.angular.
To use the bridge in your own application, the following steps are required.
Import BreezeBridgeAngularModule
and HttpModule
and add it to the app module's imports.
import { BreezeBridgeAngularModule } from 'breeze-bridge-angular';
import { Http } from '@angular/http';
@NgModule({
imports: [
BreezeBridgeAngularModule,
HttpModule
],
bootstrap: [ AppComponent ]
})
export class AppModule { }
Now we can use Breeze normally from something like a data service for example.
import { Injectable } from '@angular/core';
import { EntityManager, EntityQuery } from 'breeze-client';
import { Customer } from './entities';
@Injectable()
export class DataService {
private _em: EntityManager;
constructor() {
this._em = new EntityManager();
}
getAllCustomers(): Promise<Customer[]> {
let query = EntityQuery.from('Customers').orderBy('companyName');
return this._em.executeQuery(query)
.then(res => res.results)
.catch((error) => {
console.log(error);
return Promise.reject(error);
});
}
}