ItSolutionStuff.com

How to Run Angular App on Different Host?

By Hardik Savani • May 2, 2024
Angular

Today, run angular app in different host is our main topic. Here you will learn ng serve --host 0.0.0.0. We will use how to change host number in angular. I explained simply about how to change host number in angular. Here, Creating a basic example of how to run angular app on different host.

If you want to run your angular app on a different host then I will show two ways to change host 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 host with ng server command, let's run below command:

ng serve --host 0.0.0.0

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

http://0.0.0.0:4200

Solution 2:

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

angular.json

"projects": {

"my-project-name": {

... extra configurations

"architect": {

"serve": {

"options": {

"host": "0.0.0.0"

}

}

}

}

}

let's run app:

ng serve

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

http://0.0.0.0:4200

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 Material Checkbox Change Size Example

Read Now →

Angular 13 RxJS Observable with Httpclient Example

Read Now →

Angular 13 Image Upload with Preview Tutorial

Read Now →

Angular 13 Reactive Forms Validation Tutorial Example

Read Now →

Angular 13 Install Material Design Tutorial

Read Now →

Angular Pipe for Alphabetical Order Example

Read Now →

Angular Pipe for Phone Number Example

Read Now →

Angular Material Autocomplete with API Example

Read Now →

Angular Material Date Range Picker Example

Read Now →

Angular Google Maps with Places Search Example

Read Now →

Angular Copy to Clipboard onClick Example

Read Now →