Skip to content

Commit 7174ee5

Browse files
updated examples for 1.0 alpha0
1 parent 426f134 commit 7174ee5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,21 @@ $transitionsProvider.onBefore({ to: 'my.state', from: '*' }, function(AsyncServi
3434
return AsyncService.doSomeAsyncThing();
3535
});
3636

37-
$transitionsProvider.onBefore({ to: 'other.state', from: '*' }, function(AsyncService) {
37+
$transitionsProvider.onBefore({ to: 'other.state', from: '*' }, function($transition$, AsyncService) {
3838
// someAsyncResult added as resolve to transition. It is injectable into other resolves or controllers.
39-
return { someAsyncResult: AsyncService.doSomeAsyncThing };
39+
$transition$.addResolves({ someAsyncResult: AsyncService.doSomeAsyncThing });
4040
});
4141

4242
$transitionsProvider.onStart({ to: function(state) { return state.requiresAuth; } }, function($transition$, $state, AuthService) {
43-
return AuthService.ensureAuthenticated().catch(function() { return $state.redirect("login"); });
43+
return AuthService.ensureAuthenticated().catch(function() { return $state.target("login"); });
4444
});
4545

4646
$transitionsProvider.onStart({ to: function(state) { return state.requiresAuth; } }, function($transition$, $state, AuthService) {
47-
return AuthService.ensureAuthenticated().catch(function() { return $state.redirect("login"); });
47+
return AuthService.ensureAuthenticated().catch(function() { return $state.target("login"); });
4848
});
4949

5050
$transitionsProvider.onStart({ to: function(state) { return state.redirectTo; } }, function($transition$, $state) {
51-
return $state.redirect($transition$.to.redirectTo); });
51+
return $state.target($transition$.to.redirectTo); });
5252
});
5353
```
5454

0 commit comments

Comments
 (0)