1
- var ngMajorVer = angular . version . major ;
2
- var ngMinorVer = angular . version . minor ;
3
1
/**
4
2
* @ngdoc directive
5
3
* @name ui.router.state.directive:ui-view
@@ -24,9 +22,6 @@ var ngMinorVer = angular.version.minor;
24
22
* service, {@link ui.router.state.$uiViewScroll}. This custom service let's you
25
23
* scroll ui-view elements into view when they are populated during a state activation.
26
24
*
27
- * @param {string= } noanimation If truthy, the non-animated renderer will be selected (no animations
28
- * will be applied to the ui-view)
29
- *
30
25
* *Note: To revert back to old [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll)
31
26
* functionality, call `$uiViewScrollProvider.useAnchorScroll()`.*
32
27
*
@@ -138,35 +133,24 @@ function $ViewDirective( $state, $injector, $uiViewScroll, $interpolate)
138
133
// Returns a set of DOM manipulation functions based on which Angular version
139
134
// it should use
140
135
function getRenderer ( attrs , scope ) {
141
- var statics = {
142
- enter : function ( element , target , cb ) { target . after ( element ) ; cb ( ) ; } ,
143
- leave : function ( element , cb ) { element . remove ( ) ; cb ( ) ; }
136
+ var statics = function ( ) {
137
+ return {
138
+ enter : function ( element , target , cb ) { target . after ( element ) ; cb ( ) ; } ,
139
+ leave : function ( element , cb ) { element . remove ( ) ; cb ( ) ; }
140
+ } ;
144
141
} ;
145
142
146
- if ( ! ! attrs . noanimation ) return statics ;
147
-
148
- function animEnabled ( element ) {
149
- if ( ngMajorVer === 1 && ngMinorVer >= 4 ) return ! ! $animate . enabled ( element ) ;
150
- if ( ngMajorVer === 1 && ngMinorVer >= 2 ) return ! ! $animate . enabled ( ) ;
151
- return ( ! ! $animator ) ;
152
- }
153
-
154
- // ng 1.2+
155
143
if ( $animate ) {
156
144
return {
157
145
enter : function ( element , target , cb ) {
158
- if ( ! animEnabled ( element ) ) {
159
- statics . enter ( element , target , cb ) ;
160
- } else if ( angular . version . minor > 2 ) {
146
+ if ( angular . version . minor > 2 ) {
161
147
$animate . enter ( element , null , target ) . then ( cb ) ;
162
148
} else {
163
149
$animate . enter ( element , null , target , cb ) ;
164
150
}
165
151
} ,
166
152
leave : function ( element , cb ) {
167
- if ( ! animEnabled ( element ) ) {
168
- statics . leave ( element , cb ) ;
169
- } else if ( angular . version . minor > 2 ) {
153
+ if ( angular . version . minor > 2 ) {
170
154
$animate . leave ( element ) . then ( cb ) ;
171
155
} else {
172
156
$animate . leave ( element , cb ) ;
@@ -175,7 +159,6 @@ function $ViewDirective( $state, $injector, $uiViewScroll, $interpolate)
175
159
} ;
176
160
}
177
161
178
- // ng 1.1.5
179
162
if ( $animator ) {
180
163
var animate = $animator && $animator ( scope , attrs ) ;
181
164
@@ -185,7 +168,7 @@ function $ViewDirective( $state, $injector, $uiViewScroll, $interpolate)
185
168
} ;
186
169
}
187
170
188
- return statics ;
171
+ return statics ( ) ;
189
172
}
190
173
191
174
var directive = {
0 commit comments