New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@bondxge/config

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bondxge/config

Angular 6 config file, read config on startup

latest
Source
npmnpm
Version
0.0.6
Version published
Maintainers
1
Created
Source

@BondxgeConfig

First, install it.

$ npm install @bondxge/config

Then add config.json file in assets.

Then, import it into your @NgModule:

import { ConfigModule } from '@bondxge/config';

imports : [
    ConfigModule.forRoot('assets/config.json'),
]

Then, use it in your component:

import { CONFIG } from '@lbge/config'; CONFIG.find('yourKey');

import { Injectable } from '@angular/core';
import { HttpRequest, HttpInterceptor, HttpHandler, HttpEvent, HttpResponse, HttpErrorResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { CONFIG } from '@bondxge/config';
import { tap } from 'rxjs/operators';

@Injectable()
export class BaseUrlInterceptor implements HttpInterceptor {

    constructor() {
    }

    intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
        req = req.clone({
            url: CONFIG.find<string>('apiUrl') + req.url
        });
        return next.handle(req);
    }
}

Keywords

angular6

FAQs

Package last updated on 18 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts