Skip to content

Commit 990d14e

Browse files
committed
fix(navView): if !$animate.enabled(), do not animate
Closes #426
1 parent d804865 commit 990d14e

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

js/ext/angular/src/directive/ionicViewState.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
/**
55
* @description
6-
* The NavController is a navigation stack View Controller modelled off of
6+
* The NavController is a navigation stack View Controller modelled off of
77
* UINavigationController from Cocoa Touch. With the Nav Controller, you can
88
* "push" new "pages" on to the navigation stack, and then pop them off to go
99
* back. The NavController controls a navigation bar with a back button and title
@@ -17,12 +17,12 @@
1717
*
1818
*/
1919

20-
angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gesture'])
20+
angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gesture'])
2121

2222
/**
2323
* Our Nav Bar directive which updates as the controller state changes.
2424
*/
25-
.directive('navBar', ['$ionicViewService', '$rootScope', '$animate', '$compile',
25+
.directive('navBar', ['$ionicViewService', '$rootScope', '$animate', '$compile',
2626
function( $ionicViewService, $rootScope, $animate, $compile) {
2727

2828
/**
@@ -67,14 +67,14 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
6767
backButtonIcon: '@',
6868
alignTitle: '@'
6969
},
70-
template: '<header class="bar bar-header nav-bar invisible">' +
70+
template: '<header class="bar bar-header nav-bar invisible">' +
7171
'<div class="buttons"> ' +
7272
'<button view-back class="button" ng-if="enableBackButton"></button>' +
73-
'<button ng-click="button.tap($event)" ng-repeat="button in leftButtons" class="button no-animation {{button.type}}" ng-bind-html="button.content"></button>' +
73+
'<button ng-click="button.tap($event)" ng-repeat="button in leftButtons" class="button no-animation {{button.type}}" ng-bind-html="button.content"></button>' +
7474
'</div>' +
75-
'<h1 class="title" ng-bind-html="currentTitle"></h1>' +
75+
'<h1 class="title" ng-bind-html="currentTitle"></h1>' +
7676
'<div class="buttons" ng-if="rightButtons.length"> ' +
77-
'<button ng-click="button.tap($event)" ng-repeat="button in rightButtons" class="button no-animation {{button.type}}" ng-bind-html="button.content"></button>' +
77+
'<button ng-click="button.tap($event)" ng-repeat="button in rightButtons" class="button no-animation {{button.type}}" ng-bind-html="button.content"></button>' +
7878
'</div>' +
7979
'</header>',
8080

@@ -162,7 +162,7 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
162162
}])
163163

164164

165-
.directive('view', ['$ionicViewService', '$rootScope', '$animate',
165+
.directive('view', ['$ionicViewService', '$rootScope', '$animate',
166166
function( $ionicViewService, $rootScope, $animate) {
167167
return {
168168
restrict: 'EA',
@@ -267,10 +267,10 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
267267
}])
268268

269269

270-
.directive('navView', ['$ionicViewService', '$state', '$compile', '$controller',
271-
function( $ionicViewService, $state, $compile, $controller) {
270+
.directive('navView', ['$ionicViewService', '$state', '$compile', '$controller', '$animate',
271+
function( $ionicViewService, $state, $compile, $controller, $animate) {
272272
// IONIC's fork of Angular UI Router, v0.2.7
273-
// the navView handles registering views in the history, which animation to use, and which
273+
// the navView handles registering views in the history, which animation to use, and which
274274
var viewIsUpdating = false;
275275

276276
var directive = {
@@ -313,6 +313,11 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
313313
updateView(false);
314314

315315
function updateView(doAnimate) {
316+
//===false because $animate.enabled() is a noop without angular-animate included
317+
if ($animate.enabled() === false) {
318+
doAnimate = false;
319+
}
320+
316321
var locals = $state.$current && $state.$current.locals[name];
317322
if (locals === viewLocals) return; // nothing to do
318323
var renderer = $ionicViewService.getRenderer(element, attr, scope);

0 commit comments

Comments
 (0)