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

ng-config-module

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng-config-module

Provide configuration options through meta tags.

latest
Source
npmnpm
Version
9.0.0
Version published
Weekly downloads
17
-29.17%
Maintainers
1
Weekly downloads
 
Created
Source

ng-config-module CI npm version

Provide configuration options through meta tags.

Every property is returned as a string. numbers and boolean must be cast in the application itself.

Installation

First you need to install the npm module:

npm install ng-config-module

Usage

Import the ConfigModule

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { ConfigModule, ConfigService } from 'ng-config-module';
import { AppConfig } from './app-config';

@NgModule({
  imports: [BrowserModule, ConfigModule],
  providers: [
    {
      provide: AppConfig,
      useExisting: ConfigService
    }
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}

Create AppConfig

export class AppConfig {
  api?: string;
}

Add configurations to index.html

...
<head>
  <meta charset="utf-8" />
  <title>NgConfigModule</title>
  <base href="/" />

  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <link rel="icon" type="image/x-icon" href="favicon.ico" />
  <meta name="config" property="api" content="https://api.github.com" />
</head>
...

Use the configuration

import { Component, OnInit } from '@angular/core';
import { AppConfig } from './app-config';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
  api?: string;

  constructor(private config: AppConfig) {}

  ngOnInit() {
    this.api = this.config.api;
  }
}

Keywords

angular

FAQs

Package last updated on 01 Dec 2022

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