I was wondering if it is possible to work on two Angular(2) projects at the same time. I open my first project using ng serve
and it runs on the server and when I save it it updates. But of coarse when I try to open another project with ng serve
it will tell you that "port:4200 is already in use". Is there a way to open a project on a different port?
Seeing that this is a virtual server, I can not think that just giving it another port number can be to difficult. I do not want to log out of the one project the whole time, and then into the second one and back again after changing just one line to see if it works.
Regards
The Angular CLI since version 6 allows us to create a multi-project workspace to manage multiple Angular apps. We do that first by creating an empty workspace. A Workspace is a collection of Angular apps, projects, or libraries. Later we can add multiple projects to the workspace.
To get started, go ahead and install bit-cli, then head over to the project from which to share the components, and initialize a bit workspace. Then, head over to bit. dev and create a free account. Then, create a collection to host your shared components.
Open 2nd project then run this command:
ng serve --port 4210
Change port as you want, then open browser: localhost:[port]
Following this section:
https://github.com/angular/angular-cli#generating-and-serving-an-angular-project-via-a-development-server
Open Seconde terminal in vsCode
ng serve --port 4210
Change port number as you want, then open browser: localhost:[port]
If you're using angular-cli, It is pretty easy :
In console run :
ng serve --host 0.0.0.0 --port 4201 --live-reload-port 4915
For reference : https://github.com/angular/angular-cli
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With