/angular-client

xivapi client library (service and models) for angular applications

Primary LanguageTypeScriptMIT LicenseMIT

angular-client

CircleCI npm version

Documentation

Visit https://xivapi.com/docs for documentation about the web api mapped by this client.

Further documentation for this library available on documentation website: https://xivapi.github.io/angular-client/

Installation

Simply run npm i --save @xivapi/angular-client

Quick start

Add XivapiClientModule to your AppModule imports:

@NgModule({
    declarations: [
        AppComponent,
    ],
    imports: [
        ...
        XivapiClientModule.forRoot('my-api-key'),        
        ...
    ],
    bootstrap: [AppComponent]
})
export class AppModule {
}

In the other modules, don't call forRoot again, just import the module itself.

Then you can simply inject the service wherever you want to use it:

@Component({
    ...
})
export class FooComponent {
    
    public items$: Observable<XivapiList<any>>;
    
    constructor(private xivapi: XivapiService){
        this.items$ = this.xivapi.getList(XivapiEndpoint.Items);
    }
}