11/**
22 * State-based routing for AngularJS
3- * @version v0.2.17
3+ * @version v0.2.18
44 * @link http://angular-ui.github.com/
55 * @license MIT License, http://www.opensource.org/licenses/MIT
66 */
@@ -523,7 +523,7 @@ function $Resolve( $q, $injector) {
523523 * propagated immediately. Once the `$resolve` promise has been rejected, no
524524 * further invocables will be called.
525525 *
526- * Cyclic dependencies between invocables are not permitted and will caues `$resolve`
526+ * Cyclic dependencies between invocables are not permitted and will cause `$resolve`
527527 * to throw an error. As a special case, an injectable can depend on a parameter
528528 * with the same name as the injectable, which will be fulfilled from the `parent`
529529 * injectable of the same name. This allows inherited values to be decorated.
@@ -1270,27 +1270,27 @@ function $UrlMatcherFactory() {
12701270 function valFromString ( val ) { return val != null ? val . toString ( ) . replace ( / ~ 2 F / g, "/" ) . replace ( / ~ ~ / g, "~" ) : val ; }
12711271
12721272 var $types = { } , enqueue = true , typeQueue = [ ] , injector , defaultTypes = {
1273- string : {
1273+ " string" : {
12741274 encode : valToString ,
12751275 decode : valFromString ,
12761276 // TODO: in 1.0, make string .is() return false if value is undefined/null by default.
12771277 // In 0.2.x, string params are optional by default for backwards compat
12781278 is : function ( val ) { return val == null || ! isDefined ( val ) || typeof val === "string" ; } ,
12791279 pattern : / [ ^ / ] * /
12801280 } ,
1281- int : {
1281+ " int" : {
12821282 encode : valToString ,
12831283 decode : function ( val ) { return parseInt ( val , 10 ) ; } ,
12841284 is : function ( val ) { return isDefined ( val ) && this . decode ( val . toString ( ) ) === val ; } ,
12851285 pattern : / \d + /
12861286 } ,
1287- bool : {
1287+ " bool" : {
12881288 encode : function ( val ) { return val ? 1 : 0 ; } ,
12891289 decode : function ( val ) { return parseInt ( val , 10 ) !== 0 ; } ,
12901290 is : function ( val ) { return val === true || val === false ; } ,
12911291 pattern : / 0 | 1 /
12921292 } ,
1293- date : {
1293+ " date" : {
12941294 encode : function ( val ) {
12951295 if ( ! this . is ( val ) )
12961296 return undefined ;
@@ -1309,14 +1309,14 @@ function $UrlMatcherFactory() {
13091309 pattern : / [ 0 - 9 ] { 4 } - (?: 0 [ 1 - 9 ] | 1 [ 0 - 2 ] ) - (?: 0 [ 1 - 9 ] | [ 1 - 2 ] [ 0 - 9 ] | 3 [ 0 - 1 ] ) / ,
13101310 capture : / ( [ 0 - 9 ] { 4 } ) - ( 0 [ 1 - 9 ] | 1 [ 0 - 2 ] ) - ( 0 [ 1 - 9 ] | [ 1 - 2 ] [ 0 - 9 ] | 3 [ 0 - 1 ] ) /
13111311 } ,
1312- json : {
1312+ " json" : {
13131313 encode : angular . toJson ,
13141314 decode : angular . fromJson ,
13151315 is : angular . isObject ,
13161316 equals : angular . equals ,
13171317 pattern : / [ ^ / ] * /
13181318 } ,
1319- any : { // does not encode/decode
1319+ " any" : { // does not encode/decode
13201320 encode : angular . identity ,
13211321 decode : angular . identity ,
13221322 equals : angular . equals ,
@@ -2058,12 +2058,6 @@ function $UrlRouterProvider( $locationProvider, $urlMatcherFactory) {
20582058 return listener ;
20592059 }
20602060
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-
20672061 if ( ! interceptDeferred ) listen ( ) ;
20682062
20692063 return {
@@ -2266,7 +2260,8 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
22662260
22672261 // Derive parameters for this state and ensure they're a super-set of parent's parameters
22682262 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 ( ) ;
22702265 } ,
22712266
22722267 // If there is no explicit multi-view configuration, make one up so we don't have
@@ -3758,6 +3753,8 @@ function $ViewScrollProvider() {
37583753
37593754angular . module ( 'ui.router.state' ) . provider ( '$uiViewScroll' , $ViewScrollProvider ) ;
37603755
3756+ var ngMajorVer = angular . version . major ;
3757+ var ngMinorVer = angular . version . minor ;
37613758/**
37623759 * @ngdoc directive
37633760 * @name ui.router.state.directive:ui-view
@@ -3782,6 +3779,9 @@ angular.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider)
37823779 * service, {@link ui.router.state.$uiViewScroll}. This custom service let's you
37833780 * scroll ui-view elements into view when they are populated during a state activation.
37843781 *
3782+ * @param {string= } noanimation If truthy, the non-animated renderer will be selected (no animations
3783+ * will be applied to the ui-view)
3784+ *
37853785 * *Note: To revert back to old [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll)
37863786 * functionality, call `$uiViewScrollProvider.useAnchorScroll()`.*
37873787 *
@@ -3893,24 +3893,35 @@ function $ViewDirective( $state, $injector, $uiViewScroll, $interpolate)
38933893 // Returns a set of DOM manipulation functions based on which Angular version
38943894 // it should use
38953895 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 ( ) ; }
39013899 } ;
39023900
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+
39033910 if ( $animate ) {
39043911 return {
39053912 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 ) {
39073916 $animate . enter ( element , null , target ) . then ( cb ) ;
39083917 } else {
39093918 $animate . enter ( element , null , target , cb ) ;
39103919 }
39113920 } ,
39123921 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 ) {
39143925 $animate . leave ( element ) . then ( cb ) ;
39153926 } else {
39163927 $animate . leave ( element , cb ) ;
@@ -3919,6 +3930,7 @@ function $ViewDirective( $state, $injector, $uiViewScroll, $interpolate)
39193930 } ;
39203931 }
39213932
3933+ // ng 1.1.5
39223934 if ( $animator ) {
39233935 var animate = $animator && $animator ( scope , attrs ) ;
39243936
@@ -3928,7 +3940,7 @@ function $ViewDirective( $state, $injector, $uiViewScroll, $interpolate)
39283940 } ;
39293941 }
39303942
3931- return statics ( ) ;
3943+ return statics ;
39323944 }
39333945
39343946 var directive = {
@@ -4273,7 +4285,7 @@ function $StateRefDynamicDirective($state, $timeout) {
42734285 def . state = group [ 0 ] ; def . params = group [ 1 ] ; def . options = group [ 2 ] ;
42744286 def . href = $state . href ( def . state , def . params , def . options ) ;
42754287
4276- if ( active ) active . $$addStateInfo ( ref . state , def . params ) ;
4288+ if ( active ) active . $$addStateInfo ( def . state , def . params ) ;
42774289 if ( def . href ) attrs . $set ( type . attr , def . href ) ;
42784290 }
42794291
0 commit comments