Skip to content

Latest commit

 

History

History
63 lines (55 loc) · 1.58 KB

README.md

File metadata and controls

63 lines (55 loc) · 1.58 KB

Angular4library

SBX

Welcome, this repo is the Angular 5 implementation of sbxcorejs library.

All the functions have the implementation with Promise and with Rxjs, in case of using Promise, a polyfill of Promise must be installed if the browser does not have Promise implementation.

Examples of polyfill:

Initialization

In app.module.ts file:

import { SbxCoreModule, SbxSessionModule, SbxSessionService } from 'sbxangular';
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    SbxCoreModule,
    SbxSessionModule
  ],
  bootstrap: [AppComponent]
})
export class AppModule {
  constructor(private session: SbxSessionService) {
    this.session.initialize(domain, appKey);
  }
}

Also, you can initialize with Angular environment:

In environment.ts file:

export const environment = {
  appKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
  domain: x // Integer
}

then, in app.module.ts file:

import { SbxCoreModule, SbxSessionModule, SbxSessionService } from 'sbxangular';
import { environment } from '../environments/environment';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    SbxCoreModule,
    SbxSessionModule
  ],
  bootstrap: [AppComponent]
})
export class AppModule {
  constructor(private sbxSessionService: SbxSessionService) {
    this.sbxSessionService.initializeWithEnvironment(environment);
  }
}