title | layout | excerpt | sitemap | permalink |
---|---|---|---|---|
UI-Router for AngularJS (1.x) |
single |
The defacto standard for routing in AngularJS |
true |
/ng1/ |
{% include toc icon="columns" title="AngularJS (1.x)" %}
<iframe style="display: inline-block;" src="https://ghbtns.com/github-btn.html?user=angular-ui&repo=ui-router&type=fork&count=true&size=large" frameborder="0" scrolling="0" width="160px" height="30px"></iframe><iframe style="display: inline-block;" src="https://ghbtns.com/github-btn.html?user=angular-ui&repo=ui-router&type=star&count=true&size=large" frameborder="0" scrolling="0" width="160px" height="30px"></iframe>
UI-Router is the defacto standard for routing in AngularJS.
Influenced by the core angular router $route
and the Ember Router,
UI-Router has become the standard choice for routing non-trivial apps in AngularJS (1.x).
The UI-Router package is distributed using npm, the node package manager.
npm install --save @uirouter/angularjs
Other examples:
-
Via command line
- Adding a specific version to your project:
npm install --save @uirouter/[email protected]
- Adding a specific version to your project:
-
From http://jsdelivr.com via a
<script>
tag in your html:- Latest stable version:
<script src="//cdn.jsdelivr.net/npm/@uirouter/angularjs/release/angular-ui-router.min.js"></script>
- A specific version:
<script src="//cdn.jsdelivr.net/npm/@uirouter/[email protected]/release/angular-ui-router.min.js"></script>
- A legacy version:
<script src="//cdn.jsdelivr.net/npm/[email protected]/release/angular-ui-router.js"></script>
- Latest stable version:
-
From http://unpkg.com via a
<script>
tag in your html:- Latest stable version:
<script src="//unpkg.com/@uirouter/angularjs/release/angular-ui-router.min.js"></script>
- A specific version:
<script src="//unpkg.com/@uirouter/[email protected]/release/angular-ui-router.min.js"></script>
- A legacy version:
<script src="//unpkg.com/[email protected]/release/angular-ui-router.js"></script>
- Latest stable version:
-
From bower:
- Latest stable version:
bower install angular-ui-router
- A specific version:
bower install angular-ui-router#1.0.7
- A legacy version:
bower install angular-ui-router#0.3.1
- Latest stable version:
Note: bower releases are considered 'legacy' and are managed at https://github.com/angular-ui/angular-ui-router-bower
Learn UI-Router by following our tutorials.
The UI-Router Sample App is a non-trivial UI-Router application.
To fix a UI-Router bug, or create an enhancement, follow these steps:
The Typescript source code for UI-Router for Angular (2+) can be found at https://github.com/angular-ui/ui-router UI-Router for AngularJS (1.x) depends on UI-Router Core, which can be found at https://github.com/ui-router/core
To get started:
mkdir uirouter
cd uirouter
git clone https://github.com/angular-ui/ui-router angularjs
git clone https://github.com/ui-router/core core
cd core
npm install
npm link
npm run build
cd ../angularjs
npm install
npm link @uirouter/core
npm run build
To create a UI-Router bundle to test a bug fix against your app, run npm run package
You can then run npm link
, and then run npm link @uirouter/angularjs
in your app's directory.
Your app's npm dependency will use the local @uirouter/angularjs
package that you just built.
Alternatively, bundles are also created in release/angular-ui-router.js
.