@authllizer/ngx
v0.2.0
Published
Angular X Authllizer Module
Downloads
19
Maintainers
Readme
Angular X Authllizer Module
This module is a wrapper of Authllizer for comfortable using it in Angular X.
Example
There are Angular X example project in the source code.
Install
$ npm install --save @authllizer/ngx
# and install peer dependencies
$ npm install --save @authllizer/core
Setup
import { NgModule } from '@angular/core';
import { default as AuthllizerModule, IAuthllizerOptions } from '@authllizer/ngx';
@NgModule({
providers: [
AuthllizerModule.forRoot({
// ...
} as IAuthllizerOptions)
]
})
export class AppModule{}
Note: Authllizer auto config to use Angular HttpClient as HttpClient
Use
import { Component } from '@angular/core';
import { Authllizer } from '@authllizer/core';
@Component({...})
export class SomeComponent{
private _auth: Authllizer;
constructor(auth: Authllizer){
this._auth = auth;
}
}
Interceptor
import { NgModule } from '@angular/core';
import { HTTP_INTERCEPTORS } from '@angular/common/http';
import { TokenInterceptor } from '@authllizer/ngx';
@NgModule({
providers: [{
provide: HTTP_INTERCEPTORS,
useClass: TokenInterceptor,
multi: true
}]
})
export class AppModule{}
License
Copyright © 2017 Yisrael Eliav, Licensed under the MIT license.