1

I am working on angular 2. Project is compiling and run locally by using "ng-serve or npm-start" command. Now Teamviewer connected to access the Safari browser. In that the localhost:4200 did not run.

How to run the project locally in Teamviewer browser? I tried,

ng serve --host=localIP
ng serve --host localIP
start http://localhost:4200 & ng serve -port 4200

But nothing works.

I changed my .angular-cli.json as

"defaults": {
"serve": {
  "port": 4200,
  "host": "localIP"
},
"styleExt": "css",
"component": {}

}

and baseUrl: 'http://localIP:4200/' in config.js.

So anyone please help me what is the command to run the project locally in teamviewer? Thanks in advance.

Newbie007
  • 169
  • 1
  • 5
  • 13

1 Answers1

0

you can use ng serve --host 0.0.0.0 to make your serving available on your newtork.

Given your IP address is 1.2.3.4, other people will be able to access it through

http://1.2.3.4:4200/

If they're not on the same network, you will have to open your port for the world.

For that, you simply need a NAT PAT rule

origin: *
port range : 4200 - 4200
IP destination: 1.2.3.4
port destination: 4200

No need for teamviewer !

  • No, am using windows OS. But i need to test on Safari browser. So i connected the Safari browser from some other one by teamviewer. So i need to work on teamviewer but site could not open. – Newbie007 Jan 05 '18 at 11:23
  • Doesn't matter your OS or your browser, I'm talking to you about network. The network doesn't care about your OS or your browser, only about your IP and your port. This was one solution, if you don't want it, then I have no other one. –  Jan 05 '18 at 11:24
  • I used localip:port. It opens in all browser which in my computer. But not open with others computers. Ok where i have to add this origin: * port range : 4200 - 4200 IP destination: 1.2.3.4 port destination: 4200 – Newbie007 Jan 05 '18 at 12:35
  • yes. I used same ip. and also i need to know where i have to add which you had given before? – Newbie007 Jan 05 '18 at 12:40
  • Could you post the command you launched please ? And this is a NAT PAT rule, do you know what that is ? –  Jan 05 '18 at 12:43
  • I resolved the error. IP configuration are correct. But it could not access the port. So i turned off my local firewall and then i tried, its working now. – Newbie007 Jan 05 '18 at 12:54
  • Thank you for your help @ trichetriche. I dont know about NAT PAT rule. But i will learn about that. – Newbie007 Jan 05 '18 at 12:55
  • Oh you're at work ? I thought you were at home ! Well forget my answer then, NAT PAT stands for Network/Port Address Translation and you need access to a router to use this. Glad it worked for you ! –  Jan 05 '18 at 13:05