ItSolutionStuff.com

How to Run Angular App on Different Port?

By Hardik Savani • May 2, 2024
Angular

This post is focused on run angular app in different port. you'll learn ng serve --port 3000. This article will give you simple example of how to change port number in angular. you can understand a concept of how to change port number in angular. So, let's follow few step to create example of how to run angular app on different port.

If you want to run your angular app on a different port then I will show two ways to change port in the angular app. You can use this solution with angular 8, angular 9, angular 10, angular 11, angular 12, angular 13, angular 14, angular 15, angular 16 and angular 17 versions.

Let's see below solution:

Solution 1:

You can define direct port with ng server command, let's run below command:

ng serve --port 3000

Now, go to your browser and open the below link.

http://localhost:3000

Solution 2:

You can configure default post in angular.json file, let's run below command:

angular.json

"projects": {

"my-project-name": {

... extra configurations

"architect": {

"serve": {

"options": {

"port": 3000

}

}

}

}

}

let's run app:

ng serve

Now, go to your browser and open the below link.

http://localhost:3000

I hope it can help you...

Tags: Angular
Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

📺 Subscribe on YouTube

We Are Recommending You

Angular 12 Routing Module Example

Read Now →

Angular Material Carousel Slider Example

Read Now →

Angular Pipe for Boolean Value with Yes No Text

Read Now →

Angular Material Input Autocomplete Example

Read Now →

Angular Material Input Autocomplete Off Example

Read Now →

Angular Material Input Currency Mask Example

Read Now →

Angular Material Input Mask Date Example

Read Now →

Angular Material Datepicker Change Event Example

Read Now →

Angular Material Date Range Picker Example

Read Now →

Angular Scroll to Top of Div Element Example

Read Now →

Angular Radio Button Reactive Form Example

Read Now →