@@ -11,8 +11,7 @@ function $ViewDirective( $state, $compile, $controller, $injector, $an
11
11
var viewScope , viewLocals ,
12
12
name = attr [ directive . name ] || attr . name || '' ,
13
13
onloadExp = attr . onload || '' ,
14
- doAnimate = isDefined ( $animator ) ,
15
- animate = $animator ( scope , attr ) ;
14
+ animate = isDefined ( $animator ) && $animator ( scope , attr ) ;
16
15
17
16
// Find the details of the parent view directive (if any) and use it
18
17
// to derive our own qualified view name, then hang our own details
@@ -22,7 +21,7 @@ function $ViewDirective( $state, $compile, $controller, $injector, $an
22
21
var view = { name : name , state : null } ;
23
22
element . data ( '$uiView' , view ) ;
24
23
25
- scope . $on ( '$stateChangeSuccess' , function ( ) { updateView ( doAnimate ) ; } ) ;
24
+ scope . $on ( '$stateChangeSuccess' , function ( ) { updateView ( true ) ; } ) ;
26
25
updateView ( false ) ;
27
26
28
27
function updateView ( doAnimate ) {
@@ -31,7 +30,7 @@ function $ViewDirective( $state, $compile, $controller, $injector, $an
31
30
32
31
// Destroy previous view scope and remove content (if any)
33
32
if ( viewScope ) {
34
- if ( doAnimate ) animate . leave ( element . contents ( ) , element ) ;
33
+ if ( animate && doAnimate ) animate . leave ( element . contents ( ) , element ) ;
35
34
else element . html ( '' ) ;
36
35
37
36
viewScope . $destroy ( ) ;
@@ -43,7 +42,7 @@ function $ViewDirective( $state, $compile, $controller, $injector, $an
43
42
view . state = locals . $$state ;
44
43
45
44
var contents ;
46
- if ( doAnimate ) {
45
+ if ( animate && doAnimate ) {
47
46
contents = angular . element ( '<div></div>' ) . html ( locals . $template ) . contents ( ) ;
48
47
animate . enter ( contents , element ) ;
49
48
} else {
0 commit comments