Reputation: 1461
I have an app using the MEAN stack. When a user goes to the URL:
http://localhost:3000/edit/0
Where 0 is a record id. This seems like it would work correctly, but my scripts are not loaded in my edit.js file:
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css"></script>
<link rel="stylesheet" type="text/css" href="/css/style.css">
<script src="bower_components/jquery/jquery.min.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="bower_components/ng-file-upload/angular-file-upload-shim.min.js"></script>
The errors are like the following for every script and css file:
GET http://localhost:5000/edit/bower_components/jquery/jquery.min.js 404 (Not Found)
So it's pretty clear they are looking for scripts in an edit directory rather than my root. How can I get around this? I need to pass in the id in the params since it is a GET.
Upvotes: 0
Views: 399
Reputation: 36
Unless you specify a "base" tag in your HTML HEAD section or add '/' to tell the browser to user your domain + absolute path, Your browser adds the relative path to your URL to load a file. So either add '/' before that paths, or '../', or a base tag. good luck
Upvotes: 2