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

Nested ng-class breaks ngAnimate in Angular 1.4.0-rc.1 #11812

Closed
mgol opened this issue May 5, 2015 · 1 comment
Closed

Nested ng-class breaks ngAnimate in Angular 1.4.0-rc.1 #11812

mgol opened this issue May 5, 2015 · 1 comment

Comments

@mgol
Copy link
Member

mgol commented May 5, 2015

See the example at: http://plnkr.co/edit/Wj1G7Zwz16f03iUqwGoh?p=preview. Clicking on the red button should start an animation but it doesn't. If you swap Angular 1.4.0-rc.1 to 1.3.15, it starts to work: http://plnkr.co/edit/tNTiJSBhdyr2dNCL0oBw?p=preview

Removing the ng-class set on a button makes the issue go away.

For posterity, the code:

<!DOCTYPE html>
<html ng-app="testApp">
<head>
    <meta charset="utf-8">
    <title>Test page</title>
    <style>
        my-elem {
            position: fixed;
            width: 100%;
            height: 100%;
            display: block;
            background-color: black;
        }

        my-elem.down-add {
            transition: transform 3s;
            transform: translateY(0);
        }

        my-elem.down,
        my-elem.down-add.down-add-active {
            transform: translateY(54px);
        }

        my-elem.down-remove {
            transition: transform 4s;
            transform: translateY(54px);
        }

        my-elem,
        my-elem.down-remove.down-remove-active {
            transform: translateY(0);
        }

        button {
            position: relative;
            display: block;
            width: 100px;
            height: 30px;
            background: red;
        }

    </style>
</head>

<body>

<my-elem ng-class="{ 'down': down }" down="down"></my-elem>

<script src="https://code.angularjs.org/1.4.0-rc.1/angular.js"></script>
<script src="https://code.angularjs.org/1.4.0-rc.1/angular-animate.js"></script>
<script>
    angular
        .module('testApp', ['ngAnimate'])

        .directive('myElem', function () {
            return {
                restrict: 'E',
                template: '<button ng-class="{\'active\': down}" ng-click="down = !down">Click me</button>',
                scope: {
                    down: '=',
                },
            };
        })

        .run(function ($rootScope) {
            $rootScope.down = undefined;
        });
</script>
</body>
</html>
@mgol mgol added this to the 1.4.0-rc.2 milestone May 5, 2015
matsko added a commit to matsko/angular.js that referenced this issue May 20, 2015
…a RAF

Prior to this fix any nested class-based animations (animations that are
triggered with addClass/removeClass or ngClass) would cancel each other
out when nested in DOM structure. This fix ensures that the nested
animations are spaced out with sequenced RAFs so that parent CSS classes
are applied prior to any ancestor animations that are scheduled to run.

Closes angular#11812
matsko added a commit to matsko/angular.js that referenced this issue May 20, 2015
…a RAF

Prior to this fix any nested class-based animations (animations that are
triggered with addClass/removeClass or ngClass) would cancel each other
out when nested in DOM structure. This fix ensures that the nested
animations are spaced out with sequenced RAFs so that parent CSS classes
are applied prior to any ancestor animations that are scheduled to run.

Closes angular#11812
matsko added a commit to matsko/angular.js that referenced this issue May 20, 2015
…a RAF

Prior to this fix any nested class-based animations (animations that are
triggered with addClass/removeClass or ngClass) would cancel each other
out when nested in DOM structure. This fix ensures that the nested
animations are spaced out with sequenced RAFs so that parent CSS classes
are applied prior to any ancestor animations that are scheduled to run.

Closes angular#11812
@matsko
Copy link
Contributor

matsko commented May 20, 2015

Good things come to those who wait: #11907

matsko added a commit to matsko/angular.js that referenced this issue May 20, 2015
…ith a RAF

Prior to this fix any nested class-based animations (animations that are
triggered with addClass/removeClass or ngClass) would cancel each other
out when nested in DOM structure. This fix ensures that the nested
animations are spaced out with sequenced RAFs so that parent CSS classes
are applied prior to any ancestor animations that are scheduled to run.

Closes angular#11812
matsko added a commit to matsko/angular.js that referenced this issue May 21, 2015
…ith a RAF

Prior to this fix any nested class-based animations (animations that are
triggered with addClass/removeClass or ngClass) would cancel each other
out when nested in DOM structure. This fix ensures that the nested
animations are spaced out with sequenced RAFs so that parent CSS classes
are applied prior to any ancestor animations that are scheduled to run.

Closes angular#11812
@matsko matsko closed this as completed in 213c2a7 May 21, 2015
netman92 pushed a commit to netman92/angular.js that referenced this issue Aug 8, 2015
…ith a RAF

Prior to this fix any nested class-based animations (animations that are
triggered with addClass/removeClass or ngClass) would cancel each other
out when nested in DOM structure. This fix ensures that the nested
animations are spaced out with sequenced RAFs so that parent CSS classes
are applied prior to any ancestor animations that are scheduled to run.

Closes angular#11812
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants