Reputation: 841
I have a website with index.html
in the root folder, and a folder named apples
. Inside apples
I have another index.html
. Currently I am attempting to use AngularJS to load the same navbar into both pages. However, when I tried linking to the Javascript file like so: <script src="/controller.js">
, the JS file loads for the index.html
in the root folder, but it refuses to load the file for the index.html
in the apples
folder. Does anyone know why? In the apples
folder, it keeps linking to apples//controller.js
.
Upvotes: 0
Views: 4590
Reputation: 392
Are you running this on a server or just on your desktop? The path /controller.js should work if you're running from a web server but likely won't work if you're calling it locally.
Upvotes: 2