search

Home  >  Q&A  >  body text

angular.js - How to reference css in angularjs

RT, the route loads different pages, so how to load the css corresponding to these pages
For example

.state('active',{
    url : '/active',
    templateUrl : 'tpls/active.html'
})

How should I load the corresponding css? Some people recommend that I mix the css in one file and load it from the beginning, but this is too coupling, and it is easy to cause conflicts in one file, and it is easily affected by other attributes. If you add a prefix, the class name is too long. It gives me a headache just looking at it...

为情所困为情所困2776 days ago853

reply all(1)I'll reply

  • 巴扎黑

    巴扎黑2017-05-15 16:52:16

    Someone has already encapsulated this aspect:

    • How to specify CSS for each view in angular routing
    • angular-route-styles
    • ocLazyLoad - Load modules on demand (lazy load) in AngularJS

    reply
    0
  • Cancelreply