1

so I had my style in my main.css declared in my index.html. But when I moved it to a separate file and tried to declare the style sheet within my routeProvider it is just showing a white page with my nav bar at the top (which is styled in the main.css).. My routeProvider provider looks like.

.when('/', {
    templateUrl: 'static/partials/landing.html',
    controller: IndexController
    css: 'static/css/home.css'
})
.when('/about', {
    templateUrl: 'static/partials/about.html',
    controller: AboutController
})
.when('/post', {
    templateUrl: 'static/partials/post-list.html',
    controller: PostListController
})
.when('/post/:postId', {
    templateUrl: '/static/partials/post-detail.html',
    controller: PostDetailController
})
/* Create a "/blog" route that takes the user to the same place as "/post" */
.when('/blog', {
    templateUrl: 'static/partials/post-list.html',
    controller: PostListController
})
.otherwise({
    redirectTo: '/'
}); 

This is my first time really playing with angular so I thought I might be missing something simple. I searched the web for a while a did not come up with much.

Farhad
  • 4,119
  • 8
  • 43
  • 66
David Dennis
  • 702
  • 2
  • 9
  • 26
  • Have you checked [this](https://stackoverflow.com/questions/15193492/how-to-include-view-partial-specific-styling-in-angularjs) question right here? – Bruno Poeta Sep 03 '17 at 04:53

1 Answers1

1

You cannot just include css in the routerProvider without a library or a directive to compile, alternatively you can use angular-css

var myApp = angular.module('myApp', ['ngRoute', 'angularCSS']);

and then provide the individual css in the configuration.

Sajeetharan
  • 216,225
  • 63
  • 350
  • 396