Hi David,

Check out AngularCSS. 
It extends Angular to do exactly what you are looking for. No need to have 
that logic in controllers.

https://github.com/door3/angular-css


 $routeProvider
    .when('/page1', {
      templateUrl: 'page1/page1.html',
      controller: 'page1Ctrl',
      css: 'page1/page1.css'
    })


It also works for directives.

myApp.directive('myDirective', function () {
  return {
    restrict: 'E',
    templateUrl: 'my-directive/my-directive.html',
    css: 'my-directive/my-directive.css'
  }
});



Best,

Alex


On Friday, February 22, 2013 at 4:54:30 AM UTC-5, David Sorrentino wrote:
>
> Hello everyvody,
>
> I'm writing a website in Angular and everything seems to be going smoothly.
>
> I've got just one doubt. Is there any possibility to import a different 
> css stylesheet for each page of my website?
>
> I mean, let's assume that I have the following views: *main.html*, 
> *about.html*, *contact.html*.
> What I would like to do is to import *main.css* when I load the view 
> *main.html*, *about.css* when I load the view *about.html*, and so on.
>
> Thanks in advance for your help. ;)
>
> Best,
> David
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to