Skip to content

How to pass environment variables to my code? #4170

Closed

Description

@blackcatIan

There is
environment.prod.ts and environment.ts
I put different variables value in them like:

//environment.ts
export const environment = {
production: false,
loginurl:"localhost:8080"
};

//environment.prod.ts
export const environment = {
production: false,
loginurl:"xxx.xxx.com"
};

how can I read loginurl variable with defferent webpack environment?

Activity

  1. beeman commented on Jan 23, 2017

    @beeman
    Contributor

    @blackcatIan from the documentation in environment.ts:

    The build system defaults to the dev environment which uses `environment.ts`, but if you do
    `ng build --env=prod` then `environment.prod.ts` will be used instead.
    
  2. hansl commented on Jan 23, 2017

    @hansl
    Contributor

    Considering this as closed from @beeman comment. Cheers!

  3. angular-automatic-lock-bot commented on Sep 6, 2019

    @angular-automatic-lock-bot

    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.

  4. locked and limited conversation to collaborators on Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions