use of Environment variables in Angular 6 Library
See original GitHub issueType of Issue
I have a angular lib where i am using environment variables configured inside the environment.ts file which is reside inside the lib. when i am using the library in another angular 6 application how can i use those configuration variables present inside the environment.ts file for the library.
Those configuration variables inside the library environment.ts file are mostly clientID and tenantID which are being used for authentication and authorization which may change for different environment .
[ ] Bug Report
[ ] Feature Request
Description
A bug: please describe the error that you encountered
A feature: please describe your use case and motivation
How To Reproduce
A bug: please include instructions how to reproduce. Issues without reproduction are likely to receive no feedback.
Can you reproduce the error in the integration tests in ng-packagr?
If possible, take a look at the integration/samples
and try to break one of these builds!
Is the error you faced in an application importing the library
Try to break the Angular CLI app in integration/consumers/ng-cli
!
Expected Behaviour
A bug: please describe what behaviour or result you expected
A feature: do you have a first draft or an idea how to implement?
Version Information
$ node_modules/.bin/ng-packagr --version
ng-packagr: x.y.z
@angular/*: x.y.z
typescript: x.y.z
rxjs: x.y.z
node: x.y.z
npm/yarn: x.y.z
Please include all version numbers that might be relevant, e.g. third-party libraries
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
IMO, you should not have such configuration inside the library but rather these should be provide to the library via a
forRoot()
method from the application.From an ng-packagr perspective, there is no such as a dev/production build. There is only a single type of build.
I suggest you do follow the forRoot pattern ex;
found it: https://github.com/nrwl/nx/issues/208