javascript – AngularJS Protocolo file://


Guys, I'm making an embedded application in AngularJS that when the system (operational, not the application) starts, it opens the index.html that contains the application made in angular.

The first page works, but how do I send it to another page?

I tried using routes, but since it runs on the file:// protocol I don't have a context where I can do /anotherpage.

How can I display another page with another controller?


To work with angular you need to have an http server. However you can achieve this very simply.

1- Install nodeJs and node package manager called npm

About node:

Installation nodeJs and npm:

2- Create environment variable pointing to nodeJs installation directory

Link with the instruction:

3- Navigate to your files directory at the prompt and run the following command: http-server -a localhost -p 8000 -c-1

This command will upload an http server on port 8000. Then you just open the browser and browse the files. http://localhost:8080/

NOTE: There are workarounds to run through the file protocol. More will be a long-term problem. I recommend using this http server which is simple and powerful.

Scroll to Top