Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix(ngView): ensure the new view element is placed after the old view…
Browse files Browse the repository at this point in the history
… element

Closes #4362
  • Loading branch information
matsko authored and mhevery committed Oct 23, 2013
1 parent 2623de1 commit 3f568b2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/ngRoute/directive/ngView.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,10 @@ function ngViewFactory( $route, $anchorScroll, $compile, $controller,
if (template) {
var newScope = scope.$new();
linker(newScope, function(clone) {
cleanupLastView();

clone.html(template);
$animate.enter(clone, null, $element);
$animate.enter(clone, null, currentElement || $element);

cleanupLastView();

var link = $compile(clone.contents()),
current = $route.current;
Expand Down
11 changes: 5 additions & 6 deletions test/ngRoute/directive/ngViewSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -599,9 +599,9 @@ describe('ngView animations', function() {
$location.path('/bar');
$rootScope.$digest();

var itemA = $animate.flushNext('leave').element;
var itemA = $animate.flushNext('enter').element;
expect(itemA).not.toEqual(itemB);
var itemB = $animate.flushNext('enter').element;
var itemB = $animate.flushNext('leave').element;
}));

it('should render ngClass on ngView',
Expand Down Expand Up @@ -635,8 +635,8 @@ describe('ngView animations', function() {
$location.path('/bar');
$rootScope.$digest();

$animate.flushNext('leave').element;
item = $animate.flushNext('enter').element;
$animate.flushNext('enter').element;
item = $animate.flushNext('leave').element;

$animate.flushNext('addClass').element;
$animate.flushNext('addClass').element;
Expand Down Expand Up @@ -679,12 +679,11 @@ describe('ngView animations', function() {
$location.path('/bar');
$rootScope.$digest();

$animate.flushNext('enter'); //ngView new
$animate.flushNext('leave'); //ngView old

$rootScope.$digest();

$animate.flushNext('enter'); //ngView new

expect(n(element.text())).toEqual(''); //this is midway during the animation

$animate.flushNext('enter'); //ngRepeat 3
Expand Down

0 comments on commit 3f568b2

Please sign in to comment.