0

I want to pass a param for --configuration (environments) to angular application from package json command:

"scripts": {
    "build": "ng build"   ???
},

i need to reflect this on package.json because te current situation i cannot pass anything just using npm build --- > (final command i want is ng build --configuration=CERT).

alejoko
  • 993
  • 8
  • 14
  • 1
    this might help you https://stackoverflow.com/questions/11580961/sending-command-line-arguments-to-npm-script – Abdul Basit Feb 14 '19 at 10:35

1 Answers1

0

You can copy the environment.ts to environment.CERT.ts (if configuration = CERT). There you can add all the predefined value there, for example

export const environment = {
    name: 'CERT';
};

Then you can import it in your application, anywhere

import { environment } from 'environment'

and use it as environment.name

Hope this help

Nguyen Phong Thien
  • 3,237
  • 1
  • 15
  • 36