angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

pass an npm flag to the generated application code

Open ovione opened this issue 9 years ago • 2 comments

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x ] feature request

Versions.

@angular/cli: 1.0.2 node: 7.9.0 os: win32 x64 @angular/animations: 4.1.0 @angular/common: 4.1.0 @angular/compiler: 4.1.0 @angular/core: 4.1.0 @angular/forms: 4.1.0 @angular/http: 4.1.0 @angular/platform-browser: 4.1 @angular/platform-browser-dyna @angular/router: 4.1.0 @angular/cli: 1.0.2 @angular/compiler-cli: 4.1.0

Repro steps.

When I serve or build my project with "start": "ng serve --port 3000 --o --proxy-config proxy.conf.json", "build": "ng build", I would like to pass the 'version' number via npm. This 'version' number should be accessible in the code.

Like "start": "ng serve --port 3000 --o --proxy-config proxy.conf.json --version='1'", or "build": "ng build --version='1'"

How to et 'version' in my code ?

I also don't want to use the environment.ts because this version will change a lot.

The log given by the failure.

Desired functionality.

Mention any other details that might be useful.

ovione avatar May 09 '17 06:05 ovione

Heya, there's no way to pass custom variables onto the build system as you are asking, which makes this more of an application architecture question. There's several ways to do such a thing, but it's better to ask in places like Stack Overflow.

filipesilva avatar May 09 '17 09:05 filipesilva

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.