diff --git a/src/viewDirective.js b/src/viewDirective.js index 7b7e0f187..3610025f6 100644 --- a/src/viewDirective.js +++ b/src/viewDirective.js @@ -100,10 +100,6 @@ * Examples for `autoscroll`: * *
- * 
- * 
- *
  * 
  * 
@@ -214,7 +210,7 @@ function $ViewDirective(   $state,   $injector,   $uiViewScroll) {
 
           var clone = $transclude(newScope, function(clone) {
             renderer.enter(clone, $element, function onUiViewEnter() {
-              if (!angular.isDefined(autoScrollExp) || !autoScrollExp || scope.$eval(autoScrollExp)) {
+              if (angular.isDefined(autoScrollExp) && !autoScrollExp || scope.$eval(autoScrollExp)) {
                 $uiViewScroll(clone);
               }
             });
diff --git a/test/viewDirectiveSpec.js b/test/viewDirectiveSpec.js
index 2c184d86c..1871ec7fd 100644
--- a/test/viewDirectiveSpec.js
+++ b/test/viewDirectiveSpec.js
@@ -268,7 +268,7 @@ describe('uiView', function () {
   });
 
   describe('autoscroll attribute', function () {
-    it('should autoscroll when unspecified', inject(function ($state, $q, $uiViewScroll, $animate) {
+    it('should NOT autoscroll when unspecified', inject(function ($state, $q, $uiViewScroll, $animate) {
       elem.append($compile('
')(scope)); $state.transitionTo(aState); @@ -276,7 +276,7 @@ describe('uiView', function () { if ($animate) $animate.triggerCallbacks(); - expect($uiViewScroll).toHaveBeenCalledWith(elem.find('span').parent()); + expect($uiViewScroll).not.toHaveBeenCalled(); })); it('should autoscroll when expression is missing', inject(function ($state, $q, $uiViewScroll, $animate) {