fix(navView): if !$animate.enabled(), do not animate

Closes #426
This commit is contained in:
Andy Joslin
2014-02-05 14:41:24 -05:00
parent d804865be0
commit 990d14e8fe

View File

@@ -3,7 +3,7 @@
/**
* @description
* The NavController is a navigation stack View Controller modelled off of
* The NavController is a navigation stack View Controller modelled off of
* UINavigationController from Cocoa Touch. With the Nav Controller, you can
* "push" new "pages" on to the navigation stack, and then pop them off to go
* back. The NavController controls a navigation bar with a back button and title
@@ -17,12 +17,12 @@
*
*/
angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gesture'])
angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gesture'])
/**
* Our Nav Bar directive which updates as the controller state changes.
*/
.directive('navBar', ['$ionicViewService', '$rootScope', '$animate', '$compile',
.directive('navBar', ['$ionicViewService', '$rootScope', '$animate', '$compile',
function( $ionicViewService, $rootScope, $animate, $compile) {
/**
@@ -67,14 +67,14 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
backButtonIcon: '@',
alignTitle: '@'
},
template: '<header class="bar bar-header nav-bar invisible">' +
template: '<header class="bar bar-header nav-bar invisible">' +
'<div class="buttons"> ' +
'<button view-back class="button" ng-if="enableBackButton"></button>' +
'<button ng-click="button.tap($event)" ng-repeat="button in leftButtons" class="button no-animation {{button.type}}" ng-bind-html="button.content"></button>' +
'<button ng-click="button.tap($event)" ng-repeat="button in leftButtons" class="button no-animation {{button.type}}" ng-bind-html="button.content"></button>' +
'</div>' +
'<h1 class="title" ng-bind-html="currentTitle"></h1>' +
'<h1 class="title" ng-bind-html="currentTitle"></h1>' +
'<div class="buttons" ng-if="rightButtons.length"> ' +
'<button ng-click="button.tap($event)" ng-repeat="button in rightButtons" class="button no-animation {{button.type}}" ng-bind-html="button.content"></button>' +
'<button ng-click="button.tap($event)" ng-repeat="button in rightButtons" class="button no-animation {{button.type}}" ng-bind-html="button.content"></button>' +
'</div>' +
'</header>',
@@ -162,7 +162,7 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
}])
.directive('view', ['$ionicViewService', '$rootScope', '$animate',
.directive('view', ['$ionicViewService', '$rootScope', '$animate',
function( $ionicViewService, $rootScope, $animate) {
return {
restrict: 'EA',
@@ -267,10 +267,10 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
}])
.directive('navView', ['$ionicViewService', '$state', '$compile', '$controller',
function( $ionicViewService, $state, $compile, $controller) {
.directive('navView', ['$ionicViewService', '$state', '$compile', '$controller', '$animate',
function( $ionicViewService, $state, $compile, $controller, $animate) {
// IONIC's fork of Angular UI Router, v0.2.7
// the navView handles registering views in the history, which animation to use, and which
// the navView handles registering views in the history, which animation to use, and which
var viewIsUpdating = false;
var directive = {
@@ -313,6 +313,11 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
updateView(false);
function updateView(doAnimate) {
//===false because $animate.enabled() is a noop without angular-animate included
if ($animate.enabled() === false) {
doAnimate = false;
}
var locals = $state.$current && $state.$current.locals[name];
if (locals === viewLocals) return; // nothing to do
var renderer = $ionicViewService.getRenderer(element, attr, scope);