Notes
Version 3.0.1 is compatible with Angular 9
Version 3.0.0 is compatible with Angular 6
From Version 3.0.0, enter full Url to the API. This change is to cater for AIS version 2 API. For API version 1, append /jderest/
and /jderest/v2/
for version 2.
e1-service
E1 Service Library.
Installation
Install the Redux Store and DevTools, run:
$ npm install @ngrx/store --save
$ npm install @ngrx/store-devtools --save-dev
Then install e1-service, run:
$ npm install e1-service --save
E1 Starter
For a starter E1 project, clone e1-ng-start :
$ git clone https://github.com/Herdubreid/e1-ng-start.git < your project folder >
Consuming the e1-services
In your Angular AppModule
, add the modules and services:
import { BrowserModule } from ' @angular/platform-browser ' ;
import { NgModule } from ' @angular/core ' ;
import { AppComponent } from ' ./app.component ' ;
import { StoreModule } from ' @ngrx/store ' ;
import { StoreDevtoolsModule } from ' @ngrx/store-devtools ' ;
import { E1ServiceModule , e1Reducer } from ' e1-service ' ;
@ NgModule ( {
declarations : [
AppComponent
] ,
imports : [
BrowserModule ,
E1ServiceModule ,
StoreModule . forRoot ( { e1 : e1Reducer } ) ,
! environment . production ? StoreDevtoolsModule . instrument ( ) : [ ]
] ,
providers : [
] ,
bootstrap : [ AppComponent ]
} )
export class AppModule { }
Once e1-service is imported, you can inject it in your Angular components:
...
import { SignonService } from ' e1-service ' ;
export class AppComponent {
...
constructor (
signon : SignonService
) {
signon . testUrl ( ' https://server:port/jderest/ ' ,
{
success : ( ) => {
console . log ( ' success! ' ) ;
signon . username = ' username ' ;
signon . password = ' password ' ;
signon . authenticate (
{
success : ( ) => console . log ( ' Signed on! ' ) ,
error : ( msg ) => console . log ( ' Signon error: ' , msg ) ;
}
} ,
error : ( msg ) => {
console . log ( ' Invalid Url: ' , error ) ;
} ) ;
}
}
}
License
MIT © Finnur Bragason
e1-services