{"id":21177434,"url":"https://github.com/betsol/ng-ui-router-styles","last_synced_at":"2025-07-09T22:30:43.960Z","repository":{"id":58219039,"uuid":"53086884","full_name":"betsol/ng-ui-router-styles","owner":"betsol","description":"Load custom CSS for different routes","archived":false,"fork":false,"pushed_at":"2017-05-05T15:42:44.000Z","size":22,"stargazers_count":3,"open_issues_count":3,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-19T19:18:30.588Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/betsol.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-03T21:51:56.000Z","updated_at":"2017-06-05T14:07:31.000Z","dependencies_parsed_at":"2022-09-01T09:12:18.888Z","dependency_job_id":null,"html_url":"https://github.com/betsol/ng-ui-router-styles","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/betsol/ng-ui-router-styles","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betsol%2Fng-ui-router-styles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betsol%2Fng-ui-router-styles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betsol%2Fng-ui-router-styles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betsol%2Fng-ui-router-styles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/betsol","download_url":"https://codeload.github.com/betsol/ng-ui-router-styles/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betsol%2Fng-ui-router-styles/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264504572,"owners_count":23618824,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-20T17:16:03.346Z","updated_at":"2025-07-09T22:30:43.707Z","avatar_url":"https://github.com/betsol.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# betsol-ng-ui-router-styles\n\n[![Bower version](https://badge.fury.io/bo/betsol-ng-ui-router-styles.svg)](http://badge.fury.io/bo/betsol-ng-ui-router-styles)\n[![npm version](https://badge.fury.io/js/betsol-ng-ui-router-styles.svg)](http://badge.fury.io/js/betsol-ng-ui-router-styles)\n\n\nThis module for Angular.js [UI Router][ui-router] allows you to specify\nCSS-resources for different states. It will make sure that specified\nstyles are loaded before the state is rendered.\n\nWith it, you could split your application into fully-independent layout\nsections and get rid of style conflicts once and for all!\n\n\n## Features\n\n- Simple installation, no directives needed\n- Straightforward and flexible resource definition\n- Supports named resources with ability to override them down the chain\n- All CSS is loaded during the `resolve` stage\n\n\n## Installation\n\n### Install library with *npm*\n\n`npm i --save betsol-ng-ui-router-styles`\n\n\n### Install library with *Bower*\n\n`bower install --save betsol-ng-ui-router-styles`\n\n\n### Add library to your page\n\n``` html\n\u003cscript src=\"/node_modules/betsol-ng-ui-router-styles/dist/betsol-ng-ui-router-styles.js\"\u003e\u003c/script\u003e\n```\n\nYou should use minified version (`betsol-ng-ui-router-styles.min.js`) in production.\n\n\n### Add dependency in your application's module definition\n\n``` javascript\nvar application = angular.module('application', [\n  // ...\n  'betsol.uiRouterStyles'\n]);\n```\n\n\n## Usage\n\n```javascript\n\nangular\n  .module('application', [\n    'betsol.uiRouterStyles'\n  ])\n  .config(function ($stateProvider) {\n    $stateProvider\n      .state('root', {\n        abstract: true,\n        data: {\n          // Single un-named resource defined:\n          // Globally for entire application.\n          css: '/css/root.css'\n        }\n      })\n        .state('home', {\n          url: '/',\n          parent: 'root',\n          data: {\n            // Multiple named resources defined:\n            // You could override them down the chain if you want.\n            css: {\n              home: '/css/home.css',\n              dashboard: '/css/dashboard.css'\n            }\n          }\n        })\n          .state('home-about', {\n            url: '/about',\n            parent: 'home',\n            data: {\n              css: {\n\n                // Disabling parent named resource:\n                // You could also override it if you want.\n                dashboard: null,\n\n                // Adding another named resource:\n                about: '/css/about.css'\n              }\n            }\n          })\n        .state('sign-up', {\n          url: '/sign-up',\n          parent: 'root',\n          data: {\n            // Mixed array-style definition.\n            css: [\n\n              // Un-named resource defined by URL:\n              '/css/forms.css',\n\n              // Complete resource definition object provided:\n              { id: 'sign-up', url: '/css/sign-up.css' },\n\n              // Minimal resource definition object with no name:\n              { url: '/css/forms-extra.css' }\n\n            ]\n          }\n        })\n      ;\n    })\n;\n\n\n```\n\n## Events\n\nThis module fires the following events on the `$rootScope`:\n\n- `uiRouterStyles.loadingStarted` when loading of stylesheets is started\n- `uiRouterStyles.loadingFinished` when loading of stylesheets is finished\n\nYou can use these events to, for example, hide the content of the page using some animation\nin order to prevent [FOUC][fouc].\n\n\n## Changelog\n\nPlease see the [changelog][changelog] for list of changes.\n\n\n## Feedback\n\nIf you have found a bug or have another issue with the library —\nplease [create an issue][new-issue].\n\nIf you have a question regarding the library or it's integration with your project —\nconsider asking a question at [StackOverflow][so-ask] and sending me a\nlink via [E-Mail][email]. I will be glad to help.\n\nHave any ideas or propositions? Feel free to contact me by [E-Mail][email].\n\nCheers!\n\n\n## Developer guide\n\nFork, clone, create a feature branch, implement your feature, cover it with tests, commit, create a PR.\n\nRun:\n\n- `npm i \u0026\u0026 bower install` to initialize the project\n- `gulp build` to re-build the dist files\n- `gulp test` or `karma start` to test the code\n- `gulp test:e2e:server` to run test server on [http://localhost:1337](http://localhost:1337)\n\nDo not add dist files to the PR itself.\nWe will re-compile the module manually each time before releasing.\n\n\n## Support\n\nIf you like this library consider to add star on [GitHub repository][repo-gh].\n\nThank you!\n\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2016 Slava Fomin II, BETTER SOLUTIONS\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n  [changelog]: changelog.md\n  [so-ask]:    http://stackoverflow.com/questions/ask?tags=angularjs,javascript\n  [email]:     mailto:s.fomin@betsol.ru\n  [new-issue]: https://github.com/betsol/ng-ui-router-styles/issues/new\n  [gulp]:      http://gulpjs.com/\n  [repo-gh]:   https://github.com/betsol/ng-ui-router-styles\n  [ui-router]: https://github.com/angular-ui/ui-router\n  [fouc]:      https://en.wikipedia.org/wiki/Flash_of_unstyled_content\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbetsol%2Fng-ui-router-styles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbetsol%2Fng-ui-router-styles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbetsol%2Fng-ui-router-styles/lists"}