Skip to content

ng build on code change in an express + angular 2 app #4382

@TheJimFactor

Description

@TheJimFactor

I am trying to get my angular 2 + express app to reload itself when either the express code changes or the angular 2 app changes. My understanding is that I need to run ng build, then have express serve up the index.html file that is located in the dist/ folder.

ng serve is probably the only way to auto-reload, but I'm hoping for a 3rd party app or an option to ng build that would make it rebuild when the angular 2 code changes.

The best I can do right now is ng serve and just test the angular part. Or making an npm build script that looks like ng build && nodemon server.js which will build angular 2, and auto reload if the express code changes (but not the angular 2 code).

Thanks for any tips on how to get this done, I'm very new to angular 2.

OS?

Ubuntu

Versions.

angular-cli: 1.0.0-beta.28.3
node: 7.2.0
os: linux x64
@angular/common: 2.4.5
@angular/compiler: 2.4.5
@angular/core: 2.4.5
@angular/forms: 2.4.5
@angular/http: 2.4.5
@angular/platform-browser: 2.4.5
@angular/platform-browser-dynamic: 2.4.5
@angular/router: 3.4.5
@angular/compiler-cli: 2.4.5

Repro steps.

ng build

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