How to change angular port from 4200 to any other
Stack How?
Stackorigin – The Community of Question and Answers Latest Articles
Read More About Python List Comprehension with examples
Python List Comprehension: Python List comprehension provides a much more short syntax for creating a new list based on the values of an existing list. Advantages of List Comprehension in Python: Time Efficient than loop Space Efficient than loop Needs ...
Do not accept an offer letter from companies.
Do not accept an offer letter from companies without verifying the following points. Designation Salary Details & CTC Distribution Leave Policies Working Hours & Days Medical Coverage/Insurance Probation Period Notice Period Benefits and Perks Bonus F&F Policy
How to call API using Ajax
AJAX stands for Asynchronous JavaScript and XML and its used for to make calls to the server to fetch some data. In this article, we will learn how to implement a simple API call using AJAX technology. How to use GET ...
How To Change Angular Port (ng serve port) number from 4200 to other:
There are two ways we can change the default angular port number from 4200 to other number.
ng serve --port otherport
Angular.json
file.By default Angular CLI
ng serve
command uses port 4200 to run the application.Adding default port number in project’s angular.json file.
In latest versions of Angular i.e., Angular 10+ we can configure the default port in project’s
angular.json
file.Here are the steps to add default port number in Angular applications.
The solution worked for me was
(You can change 4401 to whatever number you want)
Then launch browser -> http://localhost:4401/
Basically, I was having two Applications and with the help of the above approach now I am able to run both of them simultaneously in my development environment.
o change port for once while running and no change in configuration you can use below command
Goto nodel_modules/angular-cli/commands/server.js Search for var defaultPort = process.env.PORT || 4200; and change 4200 to anything else you want.
ng serve –port 4500 (You an change 4500 to any number you want to use as your port)
set your preference in package.json