0

I'm often times quite overwhelmed with keeping up with technologies… I'd like to add a css style sheet to a UI Router state.

I found this post on this exact issue, but I've never used Bower. I certainly understand the benefit of Bower, but to install it, it requires node, npm and git. I've never used node or npm and would rather not research two new unrelated things in the middle of a current project.

Can I please get some insight on how to add a css style sheet to a ui router state without the use of Bower (node and npm)?

These are the instructions from the post that I don't understand.

Ensure that your application module specifies uiRouterStyles as a dependency:

angular.module('myApplication', ['uiRouterStyles'])

Add css file(s) relative path to the state data object

.state('state1', {
      url: '/state',
      controller: 'StateCtrl',
      templateUrl: 'views/my-template.html',
      data: {
        css: 'styles/some-overrides.css'
      }
    })

I understand dependency injection, but don't understand what to do with the uiRouterStyles dependency. Is this similar to a service or factory?

Community
  • 1
  • 1
  • By the looks of it, uiRouterStyles works with any css file and has no dependency on Bower. At the very bottom of https://github.com/manuelmazzuola/angular-ui-router-styles it explains how it works. – Shawn C. Dec 23 '15 at 03:32
  • Bower is just a javaScript package manager. It is actually redundant as NPM is a JavaScript package manager. If you don't want to use NPM or Bower just install `angular-ui-router-styles` the same way you are using `angular` and `angular-ui-router`. – Martin Mar 14 '16 at 10:16

1 Answers1

0

You can check this simple plunker, created by the author:

http://plnkr.co/edit/HIcYEj2QRqBCwbZCU0Il?p=preview

basically just include angular-ui-router-styles as a simple script.

<script src="path/to/angular-ui-router-styles.js"></script>
Damien Fayol
  • 958
  • 7
  • 17