@@ -47,7 +47,6 @@ export class Transition implements IHookRegistry {
47
47
static diToken = Transition ;
48
48
49
49
$id : number ;
50
- success : boolean ;
51
50
52
51
/**
53
52
* A reference to the [[UIRouter]] instance
@@ -58,18 +57,26 @@ export class Transition implements IHookRegistry {
58
57
59
58
/** @hidden */
60
59
private _deferred = services . $q . defer ( ) ;
61
- /** @hidden */
62
- private _error : any ;
63
60
/**
64
61
* This promise is resolved or rejected based on the outcome of the Transition.
65
62
*
66
63
* When the transition is successful, the promise is resolved
67
64
* When the transition is unsuccessful, the promise is rejected with the [[TransitionRejection]] or javascript error
68
65
*/
69
66
promise : Promise < any > = this . _deferred . promise ;
67
+ /**
68
+ * A boolean which indicates if the transition was successful
69
+ *
70
+ * After a successful transition, this value is set to true.
71
+ * After a failed transition, this value is set to false.
72
+ */
73
+ success : boolean ;
74
+ /** @hidden */
75
+ private _error : any ;
70
76
71
77
private _options : TransitionOptions ;
72
78
private _treeChanges : TreeChanges ;
79
+ private _targetState : TargetState ;
73
80
74
81
/** @inheritdoc */
75
82
onBefore ( matchCriteria : HookMatchCriteria , callback : TransitionHookFn , options ?: HookRegOptions ) : Function { throw "" ; } ;
@@ -102,6 +109,8 @@ export class Transition implements IHookRegistry {
102
109
*/
103
110
constructor ( fromPath : PathNode [ ] , targetState : TargetState , router : UIRouter ) {
104
111
this . router = router ;
112
+ this . _targetState = targetState ;
113
+
105
114
if ( ! targetState . valid ( ) ) {
106
115
throw new Error ( targetState . error ( ) ) ;
107
116
}
@@ -155,6 +164,17 @@ export class Transition implements IHookRegistry {
155
164
return this . $to ( ) . self ;
156
165
}
157
166
167
+ /**
168
+ * Gets the Target State
169
+ *
170
+ * A transition's [[TargetState]] encapsulates the [[to]] state, the [[params]], and the [[options]].
171
+ *
172
+ * @returns the [[TargetState]] of this Transition
173
+ */
174
+ targetState ( ) {
175
+ return this . _targetState ;
176
+ }
177
+
158
178
/**
159
179
* Determines whether two transitions are equivalent.
160
180
*/
0 commit comments