Angular-cli: How to reference ng build param in *.ts?

Created on 6 Mar 2017  Â·  4Comments  Â·  Source: angular/angular-cli

Please provide us with the following information:

OS?

Windows 10

Versions.

$ ng -v
    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / â–³ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
@angular/cli: 1.0.0-rc.0
node: 6.10.0
os: win32 x64
@angular/common: 2.4.8
@angular/compiler: 2.4.8
@angular/core: 2.4.8
@angular/forms: 2.4.8
@angular/http: 2.4.8
@angular/platform-browser: 2.4.8
@angular/platform-browser-dynamic: 2.4.8
@angular/router: 3.4.8
@angular/cli: 1.0.0-rc.0
@angular/compiler-cli: 2.4.8

Repro steps.

How to reference ng build param in *.ts?
app.module.ts

@NgModule({
    declarations: [
        AppComponent,
        NotFoundComponent
    ],
    imports: [
        BrowserModule,
        SharedModule,
        CoreModule.forRoot({ context: 'http://localhost:4200' }),
        HeaderModule,
        FooterModule,
        AppRoutingModule
    ],
    providers: [
        Location,
        AppState,
        HttpService
    ],
    bootstrap: [ AppComponent ]
})
export class AppModule { }

I want use ng build param to replace 'http://localhost:4200'...like use --bh param to change base href.

The log given by the failure.

Normally this include a stack trace and some more information.

Mention any other details that might be useful.


Thanks! We'll be in touch soon.

Most helpful comment

you could try to manage this through your environment files. Other then that I don't think there is another way.

All 4 comments

you could try to manage this through your environment files. Other then that I don't think there is another way.

@deebloo Thks...

Closing as answered, thanks @deebloo !

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._

Was this page helpful?
0 / 5 - 0 ratings