You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+97Lines changed: 97 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,100 @@
1
+
# feature-1.0 branch
2
+
## Note: this is an alpha version of UI-Router 1.0
3
+
4
+
We've totally redesigned UI-Router under the covers (rewrote about 60% of the codebase!), separating concerns and detangling the spaghetti. We have taken some new approaches which we hope will provide unprecedented flexibility and control to your UI-Router app.
5
+
6
+
We're working on a new [sample app](http://ui-router.github.io/sample-app/#/mymessages/inbox/5648b50cc586cac4aed6836f) ([Source](https://github.com/ui-router/sample-app)), as well as a [state and transition visualizer](https://github.com/ui-router/visualizer). Check them out, and give us some feedback.
7
+
8
+
9
+
#### What's changed?
10
+
11
+
##### Resolves
12
+
The Resolve API has been rewritten from scratch. We've introduced the concept of a resolve policy, which can be one of:
13
+
14
+
* EAGER: All eager resolves for a transition are resolved at the beginning, before any states are entered (this is way UI-Router 0.2.x handles resolves)
15
+
* LAZY: Lazy resolves are resolved when the state they are declared on is entered.
16
+
* JIT: Just-In-Time resolves do not resolve until just before they are injected into some other function. (extremely lazy)
17
+
18
+
In 1.0, by default, resolves on your states are "JIT"
19
+
20
+
##### Transition
21
+
22
+
We've created a Transition Service to manage transitioning from one state to another. The transition service provides hooks, which you can register a callback on. The transition hooks allow you to run code at various stages of a transition, altering it as your app requires.
23
+
24
+
The transition lifecycle hooks are currently:
25
+
26
+
* onBefore
27
+
* onStart/onInvalid
28
+
* onEnter (for individual states)
29
+
* onSuccess
30
+
* onError
31
+
32
+
When registering a hook, you can provide criteria (a state name, a glob, or a function), and you can modify the transition by returning something from the hook (an abort, a redirect, a promise, or some new resolves to add to the transition).
33
+
34
+
This enables lots of fun stuff! Here are a couple of possibilities to get your imagination started:
35
+
```javascript
36
+
// Perform some async thing before running the transition
The $state service has been heavily refactored, and is now the primary client of the $transition service. This doesn't offer the end user much *now*, but this separation should eventually enable us to provide things like multiple simultanesouly active states and parallel transitions (think UI-Router Extras "Sticky States").
62
+
63
+
State events will soon be deprecated, but can be easily re-enabled by including the stateEvents.js file. The state events have all been refactored as callbacks to the transition hooks.
64
+
65
+
##### Views
66
+
67
+
The way UI-Router manages views has been heavily refactored into a view service. This should allow us to plug in alternate rendering schemes (react?), and should help ease the transition to angular 2.
68
+
69
+
##### Parameters
70
+
71
+
This one has been a long time coming. Finally, UI-Router supports dynamic parameters in both the URL path and query string. We've included a decorator which enables reloadOnSearch behavior using dynamic params automatically.
72
+
73
+
### What's next?
74
+
75
+
We're not done making sure every use case that you've been using in UI-Router 0.2.x works just as well in 1.0. In fact, we just got the new code routing again on June 25 and have no idea what gaps are out there. We'd like to get some other eyes on this new codebase. We've moved in most of the unit tests from 0.2.x, but there are certain to be some things missing.
76
+
77
+
Build it. Try it. Let us know what's horribly broken.
78
+
79
+
#### ES6/TypeScript
80
+
81
+
We have migrated our codebase to ES6 and Typescript.
82
+
83
+
#### Angular 2
84
+
85
+
We'd are going to support Angular 2. We plan to release a ui-router-ng2 around the same time ng2 final is released.
86
+
87
+
#### Lazy Loading
88
+
89
+
We'd like to have out-of-the-box support for lazy loading states (like UI-Router Extras "Future States")
0 commit comments