how to inject API_BASE_URL (a string) in an angular service : <p>this autogenerated service (by NSwagStudio) needs an API_BASE_URL (InjectionToken) value in  order to perform http requests
how and where i can inject it?</p>

<pre><code>/* tslint:disable */
//----------------------
// &lt;auto-generated&gt;
//     Generated using the NSwag toolchain v11.12.16.0 (NJsonSchema v9.10.19.0 (Newtonsoft.Json v9.0.0.0)) (http://NSwag.org)
// &lt;/auto-generated&gt;
//----------------------
// ReSharper disable InconsistentNaming

import 'rxjs/add/observable/fromPromise';
import 'rxjs/add/observable/of';
import 'rxjs/add/observable/throw';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';
import 'rxjs/add/operator/mergeMap';
import 'rxjs/add/operator/catch';

import { Observable } from 'rxjs/Observable';
import { Injectable, Inject, Optional, InjectionToken } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams, HttpResponse, HttpResponseBase, HttpErrorResponse } from '@angular/common/http';

export const API_BASE_URL = new InjectionToken&lt;string&gt;('API_BASE_URL');

@Injectable()
export class DocumentService {
    private http: HttpClient;
    private baseUrl: string;
    protected jsonParseReviver: ((key: string, value: any) =&gt; any) | undefined = undefined;

    constructor(@Inject(HttpClient) http: HttpClient, @Optional() @Inject(API_BASE_URL) baseUrl?: string) {
        this.http = http;
        this.baseUrl = baseUrl ? baseUrl : "";
    }

    getAll(): Observable&lt;string[] | null&gt; {
        let url_ = this.baseUrl + "/api/Document";
        url_ = url_.replace(/[?&amp;]$/, "");

        let options_ : any = {
            observe: "response",
            responseType: "blob",
            headers: new HttpHeaders({
                "Content-Type": "application/json", 
                "Accept": "application/json"
            })
        };

        return this.http.request("get", url_, options_).flatMap((response_ : any) =&gt; {
            return this.processGetAll(response_);
        }).catch((response_: any) =&gt; {
            if (response_ instanceof HttpResponseBase) {
                try {
                    return this.processGetAll(&lt;any&gt;response_);
                } catch (e) {
                    return &lt;Observable&lt;string[] | null&gt;&gt;&lt;any&gt;Observable.throw(e);
                }
            } else
                return &lt;Observable&lt;string[] | null&gt;&gt;&lt;any&gt;Observable.throw(response_);
        });
    }

    protected processGetAll(response: HttpResponseBase): Observable&lt;string[] | null&gt; {
        ...........code
        ........
        ....
    }
}
</code></pre>

<p>may someone give me some super quick tips about how InjectioToken works and how inject it into this service?</p>

<p>Angular5 - Nswag</p>
