1
1
/**
2
2
* State-based routing for AngularJS
3
- * @version v0.2.17
3
+ * @version v0.2.18
4
4
* @link http://angular-ui.github.com/
5
5
* @license MIT License, http://www.opensource.org/licenses/MIT
6
6
*/
@@ -523,7 +523,7 @@ function $Resolve( $q, $injector) {
523
523
* propagated immediately. Once the `$resolve` promise has been rejected, no
524
524
* further invocables will be called.
525
525
*
526
- * Cyclic dependencies between invocables are not permitted and will caues `$resolve`
526
+ * Cyclic dependencies between invocables are not permitted and will cause `$resolve`
527
527
* to throw an error. As a special case, an injectable can depend on a parameter
528
528
* with the same name as the injectable, which will be fulfilled from the `parent`
529
529
* injectable of the same name. This allows inherited values to be decorated.
@@ -1270,27 +1270,27 @@ function $UrlMatcherFactory() {
1270
1270
function valFromString ( val ) { return val != null ? val . toString ( ) . replace ( / ~ 2 F / g, "/" ) . replace ( / ~ ~ / g, "~" ) : val ; }
1271
1271
1272
1272
var $types = { } , enqueue = true , typeQueue = [ ] , injector , defaultTypes = {
1273
- string : {
1273
+ " string" : {
1274
1274
encode : valToString ,
1275
1275
decode : valFromString ,
1276
1276
// TODO: in 1.0, make string .is() return false if value is undefined/null by default.
1277
1277
// In 0.2.x, string params are optional by default for backwards compat
1278
1278
is : function ( val ) { return val == null || ! isDefined ( val ) || typeof val === "string" ; } ,
1279
1279
pattern : / [ ^ / ] * /
1280
1280
} ,
1281
- int : {
1281
+ " int" : {
1282
1282
encode : valToString ,
1283
1283
decode : function ( val ) { return parseInt ( val , 10 ) ; } ,
1284
1284
is : function ( val ) { return isDefined ( val ) && this . decode ( val . toString ( ) ) === val ; } ,
1285
1285
pattern : / \d + /
1286
1286
} ,
1287
- bool : {
1287
+ " bool" : {
1288
1288
encode : function ( val ) { return val ? 1 : 0 ; } ,
1289
1289
decode : function ( val ) { return parseInt ( val , 10 ) !== 0 ; } ,
1290
1290
is : function ( val ) { return val === true || val === false ; } ,
1291
1291
pattern : / 0 | 1 /
1292
1292
} ,
1293
- date : {
1293
+ " date" : {
1294
1294
encode : function ( val ) {
1295
1295
if ( ! this . is ( val ) )
1296
1296
return undefined ;
@@ -1309,14 +1309,14 @@ function $UrlMatcherFactory() {
1309
1309
pattern : / [ 0 - 9 ] { 4 } - (?: 0 [ 1 - 9 ] | 1 [ 0 - 2 ] ) - (?: 0 [ 1 - 9 ] | [ 1 - 2 ] [ 0 - 9 ] | 3 [ 0 - 1 ] ) / ,
1310
1310
capture : / ( [ 0 - 9 ] { 4 } ) - ( 0 [ 1 - 9 ] | 1 [ 0 - 2 ] ) - ( 0 [ 1 - 9 ] | [ 1 - 2 ] [ 0 - 9 ] | 3 [ 0 - 1 ] ) /
1311
1311
} ,
1312
- json : {
1312
+ " json" : {
1313
1313
encode : angular . toJson ,
1314
1314
decode : angular . fromJson ,
1315
1315
is : angular . isObject ,
1316
1316
equals : angular . equals ,
1317
1317
pattern : / [ ^ / ] * /
1318
1318
} ,
1319
- any : { // does not encode/decode
1319
+ " any" : { // does not encode/decode
1320
1320
encode : angular . identity ,
1321
1321
decode : angular . identity ,
1322
1322
equals : angular . equals ,
@@ -2058,12 +2058,6 @@ function $UrlRouterProvider( $locationProvider, $urlMatcherFactory) {
2058
2058
return listener ;
2059
2059
}
2060
2060
2061
- rules . sort ( function ( ruleA , ruleB ) {
2062
- var aLength = ruleA . prefix ? ruleA . prefix . length : 0 ;
2063
- var bLength = ruleB . prefix ? ruleB . prefix . length : 0 ;
2064
- return bLength - aLength ;
2065
- } ) ;
2066
-
2067
2061
if ( ! interceptDeferred ) listen ( ) ;
2068
2062
2069
2063
return {
@@ -2266,7 +2260,8 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
2266
2260
2267
2261
// Derive parameters for this state and ensure they're a super-set of parent's parameters
2268
2262
params : function ( state ) {
2269
- return state . parent && state . parent . params ? extend ( state . parent . params . $$new ( ) , state . ownParams ) : new $$UMFP . ParamSet ( ) ;
2263
+ var ownParams = pick ( state . ownParams , state . ownParams . $$keys ( ) ) ;
2264
+ return state . parent && state . parent . params ? extend ( state . parent . params . $$new ( ) , ownParams ) : new $$UMFP . ParamSet ( ) ;
2270
2265
} ,
2271
2266
2272
2267
// If there is no explicit multi-view configuration, make one up so we don't have
@@ -3758,6 +3753,8 @@ function $ViewScrollProvider() {
3758
3753
3759
3754
angular . module ( 'ui.router.state' ) . provider ( '$uiViewScroll' , $ViewScrollProvider ) ;
3760
3755
3756
+ var ngMajorVer = angular . version . major ;
3757
+ var ngMinorVer = angular . version . minor ;
3761
3758
/**
3762
3759
* @ngdoc directive
3763
3760
* @name ui.router.state.directive:ui-view
@@ -3782,6 +3779,9 @@ angular.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider)
3782
3779
* service, {@link ui.router.state.$uiViewScroll}. This custom service let's you
3783
3780
* scroll ui-view elements into view when they are populated during a state activation.
3784
3781
*
3782
+ * @param {string= } noanimation If truthy, the non-animated renderer will be selected (no animations
3783
+ * will be applied to the ui-view)
3784
+ *
3785
3785
* *Note: To revert back to old [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll)
3786
3786
* functionality, call `$uiViewScrollProvider.useAnchorScroll()`.*
3787
3787
*
@@ -3893,24 +3893,35 @@ function $ViewDirective( $state, $injector, $uiViewScroll, $interpolate)
3893
3893
// Returns a set of DOM manipulation functions based on which Angular version
3894
3894
// it should use
3895
3895
function getRenderer ( attrs , scope ) {
3896
- var statics = function ( ) {
3897
- return {
3898
- enter : function ( element , target , cb ) { target . after ( element ) ; cb ( ) ; } ,
3899
- leave : function ( element , cb ) { element . remove ( ) ; cb ( ) ; }
3900
- } ;
3896
+ var statics = {
3897
+ enter : function ( element , target , cb ) { target . after ( element ) ; cb ( ) ; } ,
3898
+ leave : function ( element , cb ) { element . remove ( ) ; cb ( ) ; }
3901
3899
} ;
3902
3900
3901
+ if ( ! ! attrs . noanimation ) return statics ;
3902
+
3903
+ function animEnabled ( element ) {
3904
+ if ( ngMajorVer === 1 && ngMinorVer >= 4 ) return ! ! $animate . enabled ( element ) ;
3905
+ if ( ngMajorVer === 1 && ngMinorVer >= 2 ) return ! ! $animate . enabled ( ) ;
3906
+ return ( ! ! $animator ) ;
3907
+ }
3908
+
3909
+ // ng 1.2+
3903
3910
if ( $animate ) {
3904
3911
return {
3905
3912
enter : function ( element , target , cb ) {
3906
- if ( angular . version . minor > 2 ) {
3913
+ if ( ! animEnabled ( element ) ) {
3914
+ statics . enter ( element , target , cb ) ;
3915
+ } else if ( angular . version . minor > 2 ) {
3907
3916
$animate . enter ( element , null , target ) . then ( cb ) ;
3908
3917
} else {
3909
3918
$animate . enter ( element , null , target , cb ) ;
3910
3919
}
3911
3920
} ,
3912
3921
leave : function ( element , cb ) {
3913
- if ( angular . version . minor > 2 ) {
3922
+ if ( ! animEnabled ( element ) ) {
3923
+ statics . leave ( element , cb ) ;
3924
+ } else if ( angular . version . minor > 2 ) {
3914
3925
$animate . leave ( element ) . then ( cb ) ;
3915
3926
} else {
3916
3927
$animate . leave ( element , cb ) ;
@@ -3919,6 +3930,7 @@ function $ViewDirective( $state, $injector, $uiViewScroll, $interpolate)
3919
3930
} ;
3920
3931
}
3921
3932
3933
+ // ng 1.1.5
3922
3934
if ( $animator ) {
3923
3935
var animate = $animator && $animator ( scope , attrs ) ;
3924
3936
@@ -3928,7 +3940,7 @@ function $ViewDirective( $state, $injector, $uiViewScroll, $interpolate)
3928
3940
} ;
3929
3941
}
3930
3942
3931
- return statics ( ) ;
3943
+ return statics ;
3932
3944
}
3933
3945
3934
3946
var directive = {
@@ -4273,7 +4285,7 @@ function $StateRefDynamicDirective($state, $timeout) {
4273
4285
def . state = group [ 0 ] ; def . params = group [ 1 ] ; def . options = group [ 2 ] ;
4274
4286
def . href = $state . href ( def . state , def . params , def . options ) ;
4275
4287
4276
- if ( active ) active . $$addStateInfo ( ref . state , def . params ) ;
4288
+ if ( active ) active . $$addStateInfo ( def . state , def . params ) ;
4277
4289
if ( def . href ) attrs . $set ( type . attr , def . href ) ;
4278
4290
}
4279
4291
0 commit comments