I have an app using AngularJS. Here is a link of it - Angular App All the links in the navbar are using default angular router. All the pages work fine when i refresh them, but a page like this loads the content without css and js when i refresh it or go to it directly.
I feel this is a issue with the routing although I am not sure. Here is the app.js
file -
angular
.module('jobSeekerApp', [
'ngRoute'
])
.config(function ($routeProvider, $locationProvider) {
$routeProvider
.when('/', {
templateUrl: 'views/main.html',
controller: 'MainCtrl',
controllerAs: 'main'
})
.when('/about', {
templateUrl: 'views/about.html',
controller: 'AboutCtrl',
controllerAs: 'about'
})
.when('/companies', {
templateUrl: 'views/companiesall.html',
controller: 'CompaniesallCtrl',
controllerAs: 'companies'
})
.when('/jobs', {
templateUrl: 'views/jobsall.html',
controller: 'JobsallCtrl',
controllerAs: 'jobs'
})
.when('/companies/:id', {
templateUrl: 'views/company.html',
controller: 'CompanyCtrl',
controllerAs: 'company'
})
.when('/contact', {
templateUrl: 'views/contact.html',
controller: 'ContactCtrl',
controllerAs: 'contact'
})
.otherwise({
redirectTo: '/'
});
$locationProvider.html5Mode(true);
$locationProvider.hashPrefix = '!';
});
This is the head from index.html
-
<head>
<meta charset="utf-8">
<title>Job Seeker</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<!-- build:css(.) styles/vendor.css -->
<!-- bower:css -->
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="bower_components/animate.css/animate.css" />
<link rel="stylesheet" href="bower_components/jssocials/dist/jssocials.css" />
<link rel="stylesheet" href="bower_components/jssocials/dist/jssocials-theme-flat.css" />
<!-- endbower -->
<!-- endbuild -->
<!-- build:css(.tmp) styles/main.css -->
<link rel="stylesheet" href="/styles/main.css">
<!-- endbuild -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Bungee|Carrois+Gothic+SC|Oswald" rel="stylesheet">
<base href="/">
</head>
/styles......
instead ofstyles....
? Being that the "styles" folder is on your root". Note the "/".<link rel="stylesheet" href="/styles/main.8c4005ba.css">
– Kienan