I'm building an AngularJS application with routed views and to be clear the routing is working, as in the template pages in my /views/ folder are asynchronously loading into the view div on my index.html page.
The problem: These used to be seperate pages linked together the old fashioned way. Index.html, deal.html, and merchant.html. They all rendered perfectly in all browsers at that point but when I added this AngularJS routes feature, the same code is being dropped into the index.html file but the pages are not rendering properly. A lot of the styles are there... just misaligned. I can't wrap my head around it. I've looked everywhere and nobody seems to have documented this issue.
Here's what I've got so far:
head:
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular-route.js"></script>
<script src="app.js"></script>
The file system:
index.html
app.js
/views/main.html
/views/merchant.html
/views/deal.html
assets/css/
img/
index.html:
<div id="main">
<div class="ng-view" autoscroll="true"></div>
</div>
My app.js:
var appName = angular.module('adamApp', ['ngRoute']);
// configure routes
appName.config(function($routeProvider) {
$routeProvider.when('/', {
templateUrl : 'partials/home.html',
controller : 'mainController'
});
$routeProvider.when('/merchant', {
templateUrl : 'partials/merchant.html',
controller : 'merchantController'
});
$routeProvider.when('/deal', {
templateUrl : 'partials/deal.html',
controller : 'dealController'
});
$routeProvider.otherwise({ redirectTo: "/" });
});
Screenshot of old version of site without Angular routes:
Screenshot of Angular routes version with broken stylesheet:
Any ideas on what's going on?