ui-router / sample-app-angular-hybrid

UI-Router Hybrid Sample App: Route to Angular 1 and Angular 2 components
https://ui-router.github.io/sample-app-angular-hybrid
101 stars 63 forks source link

UI-Router 1.0 Hybrid Angular-CLI/AngularJS Sample Application

You can run and edit this live in your browser using https://stackblitz.com/github/ui-router/sample-app-angular-hybrid

This sample app is intended to demonstrate a non-trivial ui-router application.


Running

npm install npm start

Webpack without Angular-CLI

The sample app uses the Angular CLI. However, there is also a branch which demonstrates a custom webpack config) but no angular-cli.

Visualizer

We're using the State and Transition Visualizer to visually represent the current state tree, as well as the transitions between states. Explore how transitions work by hovering over them, and clicking to expand details (params and resolves).

Note how states are entered when they were previously not active, exited and re-entered when parameters change, and how parent states whose parameters did not change are retained. Each of these (exited, entered, retained) correspond to a Transition Hook.

Structure

The application is written in Typescript and utilizes ES6 modules. We are loading and bundling modules using webpack.

There are many ways to structure a ui-router app. We aren't super opinionated on application structure. Use what works for you. We organized ours in the following way:

UI-Router Patterns