How to detect when ripple has finished animating in Angular 4+?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















So I have a list of todos, each with a ripple, and when you click the todo I want to route the page to a new URL but I want the ripple animation to complete before this.



In Angular 4+ I can't find a way to do this easily, the only solution I have come up with so far is the following one, is there a "right" way to do this in Angular?



The component:



export class TodoListComponent {
public todos = this.todoService.todos$;

@ViewChildren(MatRipple) private ripples: QueryList<MatRipple>;

constructor(private todoService: TodoService, private router: Router) {}

public onGoTo(event: MouseEvent, index: number, todo: Todo): void {
const enterDuration = 300;
const exitDuration = 50;

const rippleRef = this.ripples
.toArray()
[index].launch(event.clientX, event.clientY, {
animation: {
enterDuration,
exitDuration,
},
});
setTimeout(() => rippleRef.fadeOut, enterDuration);
const animationDuration = enterDuration + exitDuration;
setTimeout(() => this.router.navigate([todo.id]), animationDuration);
}
}


The template:



<mat-list>
<mat-list-item
*ngFor="let todo of (todos | async); let index = index"
mat-ripple
[matRippleDisabled]="true"
>
<div class="Todo">
<div class="Todo__Label" (click)="onGoTo($event, index, todo)">
{{ todo.title }}
</div>
</div>
</mat-list-item>
</mat-list>









share|improve this question





























    1















    So I have a list of todos, each with a ripple, and when you click the todo I want to route the page to a new URL but I want the ripple animation to complete before this.



    In Angular 4+ I can't find a way to do this easily, the only solution I have come up with so far is the following one, is there a "right" way to do this in Angular?



    The component:



    export class TodoListComponent {
    public todos = this.todoService.todos$;

    @ViewChildren(MatRipple) private ripples: QueryList<MatRipple>;

    constructor(private todoService: TodoService, private router: Router) {}

    public onGoTo(event: MouseEvent, index: number, todo: Todo): void {
    const enterDuration = 300;
    const exitDuration = 50;

    const rippleRef = this.ripples
    .toArray()
    [index].launch(event.clientX, event.clientY, {
    animation: {
    enterDuration,
    exitDuration,
    },
    });
    setTimeout(() => rippleRef.fadeOut, enterDuration);
    const animationDuration = enterDuration + exitDuration;
    setTimeout(() => this.router.navigate([todo.id]), animationDuration);
    }
    }


    The template:



    <mat-list>
    <mat-list-item
    *ngFor="let todo of (todos | async); let index = index"
    mat-ripple
    [matRippleDisabled]="true"
    >
    <div class="Todo">
    <div class="Todo__Label" (click)="onGoTo($event, index, todo)">
    {{ todo.title }}
    </div>
    </div>
    </mat-list-item>
    </mat-list>









    share|improve this question

























      1












      1








      1








      So I have a list of todos, each with a ripple, and when you click the todo I want to route the page to a new URL but I want the ripple animation to complete before this.



      In Angular 4+ I can't find a way to do this easily, the only solution I have come up with so far is the following one, is there a "right" way to do this in Angular?



      The component:



      export class TodoListComponent {
      public todos = this.todoService.todos$;

      @ViewChildren(MatRipple) private ripples: QueryList<MatRipple>;

      constructor(private todoService: TodoService, private router: Router) {}

      public onGoTo(event: MouseEvent, index: number, todo: Todo): void {
      const enterDuration = 300;
      const exitDuration = 50;

      const rippleRef = this.ripples
      .toArray()
      [index].launch(event.clientX, event.clientY, {
      animation: {
      enterDuration,
      exitDuration,
      },
      });
      setTimeout(() => rippleRef.fadeOut, enterDuration);
      const animationDuration = enterDuration + exitDuration;
      setTimeout(() => this.router.navigate([todo.id]), animationDuration);
      }
      }


      The template:



      <mat-list>
      <mat-list-item
      *ngFor="let todo of (todos | async); let index = index"
      mat-ripple
      [matRippleDisabled]="true"
      >
      <div class="Todo">
      <div class="Todo__Label" (click)="onGoTo($event, index, todo)">
      {{ todo.title }}
      </div>
      </div>
      </mat-list-item>
      </mat-list>









      share|improve this question














      So I have a list of todos, each with a ripple, and when you click the todo I want to route the page to a new URL but I want the ripple animation to complete before this.



      In Angular 4+ I can't find a way to do this easily, the only solution I have come up with so far is the following one, is there a "right" way to do this in Angular?



      The component:



      export class TodoListComponent {
      public todos = this.todoService.todos$;

      @ViewChildren(MatRipple) private ripples: QueryList<MatRipple>;

      constructor(private todoService: TodoService, private router: Router) {}

      public onGoTo(event: MouseEvent, index: number, todo: Todo): void {
      const enterDuration = 300;
      const exitDuration = 50;

      const rippleRef = this.ripples
      .toArray()
      [index].launch(event.clientX, event.clientY, {
      animation: {
      enterDuration,
      exitDuration,
      },
      });
      setTimeout(() => rippleRef.fadeOut, enterDuration);
      const animationDuration = enterDuration + exitDuration;
      setTimeout(() => this.router.navigate([todo.id]), animationDuration);
      }
      }


      The template:



      <mat-list>
      <mat-list-item
      *ngFor="let todo of (todos | async); let index = index"
      mat-ripple
      [matRippleDisabled]="true"
      >
      <div class="Todo">
      <div class="Todo__Label" (click)="onGoTo($event, index, todo)">
      {{ todo.title }}
      </div>
      </div>
      </mat-list-item>
      </mat-list>






      angular angular-material angular-animations






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 3 at 20:57









      Dominic SantosDominic Santos

      1,5741013




      1,5741013
























          2 Answers
          2






          active

          oldest

          votes


















          1















          In Angular 4+ I can't find a way to do this easily, the only solution I have come up with so far is the following one, is there a "right" way to do this in Angular?




          No, there is no Angular way because the MatRipple component isn't done in the Angular way. The ripple effects are managed manually by the RippleRenderer, and it doesn't look like it uses Angular animations.



          https://github.com/angular/material2/blob/master/src/lib/core/ripple/ripple-renderer.ts



          const rippleRef = this.ripples
          .toArray()
          [index].launch(event.clientX, event.clientY, {
          animation: {
          enterDuration,
          exitDuration,
          },
          });


          The RippleRef object is returned by launch will tell you what the current state of the ripple is. There is a rippleRef.state property that will change overtime as the RippleRenderer performs the animation.



          https://github.com/angular/material2/blob/master/src/lib/core/ripple/ripple-ref.ts



          You can try to hack together an observable that will emit when the ripple animation is finished, but your only other alternative is to use setTimeout().



           interval(100)
          .pipe(
          map(()=>rippleRef.state),
          distinctUntilChanged(),
          filter(state=>state === RippleState.HIDDEN),
          first()
          ).subscribe(()=> {
          console.log('ripple animation finished');
          });


          I'm not sure if the above will work, because the first state is HIDDEN and then it transitions back to HIDDEN. I assume that interval(100) will skip the first HIDDEN state.






          share|improve this answer































            0














            Angular supported @animation.start and @animation.done to tap into animation events.



            For example, you can use



            (@routeAnimation.start)=onStart($event) and (@routeAnimation.done)=onDone($event) in your component.



            You can find out more at Angular animations



            Hope this help!



            Example code:






            import { Component, OnInit } from '@angular/core';
            import { trigger, state, style, animate, transition } from '@angular/core';


            @Component({
            selector: 'app-first',
            template: `
            <div class="w9914420" [@routeAnimation]="show"
            (@routeAnimation.start)="onStart($event)"
            (@routeAnimation.done)="onDone($event)">
            <h2>
            first-component Works!
            </h2>
            </div>
            `,
            host: {
            '[@routeAnimation]': 'true',
            '[style.display]': "'block'",
            '[style.position]': "'absolute'"
            },
            animations: [
            trigger('routeAnimation', [
            state('*', style({transform: 'translateX(0)', opacity: 1})),
            transition('void => *', [style({transform: 'translateX(-100%)', opacity: 0}),animate(500)]),
            transition('* => void', animate(500, style({transform: 'translateX(100%)', opacity: 0})))
            ])
            ]
            })
            export class FirstComponent implements OnInit {

            constructor() { }

            ngOnInit() {

            }

            onStart($event) {
            // call this function at start of the animation.
            console.log('starting animation');
            }

            onDone($event) {
            // call this function at the end of the animation.
            console.log('the end of the animation');
            }

            }








            share|improve this answer
























            • It is an old post. Please try github.com/yohaneslumentut/ng-ripple-module . if someone still need an angular way in the future.

              – yohanes
              Jan 20 at 4:04












            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54029701%2fhow-to-detect-when-ripple-has-finished-animating-in-angular-4%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1















            In Angular 4+ I can't find a way to do this easily, the only solution I have come up with so far is the following one, is there a "right" way to do this in Angular?




            No, there is no Angular way because the MatRipple component isn't done in the Angular way. The ripple effects are managed manually by the RippleRenderer, and it doesn't look like it uses Angular animations.



            https://github.com/angular/material2/blob/master/src/lib/core/ripple/ripple-renderer.ts



            const rippleRef = this.ripples
            .toArray()
            [index].launch(event.clientX, event.clientY, {
            animation: {
            enterDuration,
            exitDuration,
            },
            });


            The RippleRef object is returned by launch will tell you what the current state of the ripple is. There is a rippleRef.state property that will change overtime as the RippleRenderer performs the animation.



            https://github.com/angular/material2/blob/master/src/lib/core/ripple/ripple-ref.ts



            You can try to hack together an observable that will emit when the ripple animation is finished, but your only other alternative is to use setTimeout().



             interval(100)
            .pipe(
            map(()=>rippleRef.state),
            distinctUntilChanged(),
            filter(state=>state === RippleState.HIDDEN),
            first()
            ).subscribe(()=> {
            console.log('ripple animation finished');
            });


            I'm not sure if the above will work, because the first state is HIDDEN and then it transitions back to HIDDEN. I assume that interval(100) will skip the first HIDDEN state.






            share|improve this answer




























              1















              In Angular 4+ I can't find a way to do this easily, the only solution I have come up with so far is the following one, is there a "right" way to do this in Angular?




              No, there is no Angular way because the MatRipple component isn't done in the Angular way. The ripple effects are managed manually by the RippleRenderer, and it doesn't look like it uses Angular animations.



              https://github.com/angular/material2/blob/master/src/lib/core/ripple/ripple-renderer.ts



              const rippleRef = this.ripples
              .toArray()
              [index].launch(event.clientX, event.clientY, {
              animation: {
              enterDuration,
              exitDuration,
              },
              });


              The RippleRef object is returned by launch will tell you what the current state of the ripple is. There is a rippleRef.state property that will change overtime as the RippleRenderer performs the animation.



              https://github.com/angular/material2/blob/master/src/lib/core/ripple/ripple-ref.ts



              You can try to hack together an observable that will emit when the ripple animation is finished, but your only other alternative is to use setTimeout().



               interval(100)
              .pipe(
              map(()=>rippleRef.state),
              distinctUntilChanged(),
              filter(state=>state === RippleState.HIDDEN),
              first()
              ).subscribe(()=> {
              console.log('ripple animation finished');
              });


              I'm not sure if the above will work, because the first state is HIDDEN and then it transitions back to HIDDEN. I assume that interval(100) will skip the first HIDDEN state.






              share|improve this answer


























                1












                1








                1








                In Angular 4+ I can't find a way to do this easily, the only solution I have come up with so far is the following one, is there a "right" way to do this in Angular?




                No, there is no Angular way because the MatRipple component isn't done in the Angular way. The ripple effects are managed manually by the RippleRenderer, and it doesn't look like it uses Angular animations.



                https://github.com/angular/material2/blob/master/src/lib/core/ripple/ripple-renderer.ts



                const rippleRef = this.ripples
                .toArray()
                [index].launch(event.clientX, event.clientY, {
                animation: {
                enterDuration,
                exitDuration,
                },
                });


                The RippleRef object is returned by launch will tell you what the current state of the ripple is. There is a rippleRef.state property that will change overtime as the RippleRenderer performs the animation.



                https://github.com/angular/material2/blob/master/src/lib/core/ripple/ripple-ref.ts



                You can try to hack together an observable that will emit when the ripple animation is finished, but your only other alternative is to use setTimeout().



                 interval(100)
                .pipe(
                map(()=>rippleRef.state),
                distinctUntilChanged(),
                filter(state=>state === RippleState.HIDDEN),
                first()
                ).subscribe(()=> {
                console.log('ripple animation finished');
                });


                I'm not sure if the above will work, because the first state is HIDDEN and then it transitions back to HIDDEN. I assume that interval(100) will skip the first HIDDEN state.






                share|improve this answer














                In Angular 4+ I can't find a way to do this easily, the only solution I have come up with so far is the following one, is there a "right" way to do this in Angular?




                No, there is no Angular way because the MatRipple component isn't done in the Angular way. The ripple effects are managed manually by the RippleRenderer, and it doesn't look like it uses Angular animations.



                https://github.com/angular/material2/blob/master/src/lib/core/ripple/ripple-renderer.ts



                const rippleRef = this.ripples
                .toArray()
                [index].launch(event.clientX, event.clientY, {
                animation: {
                enterDuration,
                exitDuration,
                },
                });


                The RippleRef object is returned by launch will tell you what the current state of the ripple is. There is a rippleRef.state property that will change overtime as the RippleRenderer performs the animation.



                https://github.com/angular/material2/blob/master/src/lib/core/ripple/ripple-ref.ts



                You can try to hack together an observable that will emit when the ripple animation is finished, but your only other alternative is to use setTimeout().



                 interval(100)
                .pipe(
                map(()=>rippleRef.state),
                distinctUntilChanged(),
                filter(state=>state === RippleState.HIDDEN),
                first()
                ).subscribe(()=> {
                console.log('ripple animation finished');
                });


                I'm not sure if the above will work, because the first state is HIDDEN and then it transitions back to HIDDEN. I assume that interval(100) will skip the first HIDDEN state.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 3 at 21:30









                cgTagcgTag

                24.5k865114




                24.5k865114

























                    0














                    Angular supported @animation.start and @animation.done to tap into animation events.



                    For example, you can use



                    (@routeAnimation.start)=onStart($event) and (@routeAnimation.done)=onDone($event) in your component.



                    You can find out more at Angular animations



                    Hope this help!



                    Example code:






                    import { Component, OnInit } from '@angular/core';
                    import { trigger, state, style, animate, transition } from '@angular/core';


                    @Component({
                    selector: 'app-first',
                    template: `
                    <div class="w9914420" [@routeAnimation]="show"
                    (@routeAnimation.start)="onStart($event)"
                    (@routeAnimation.done)="onDone($event)">
                    <h2>
                    first-component Works!
                    </h2>
                    </div>
                    `,
                    host: {
                    '[@routeAnimation]': 'true',
                    '[style.display]': "'block'",
                    '[style.position]': "'absolute'"
                    },
                    animations: [
                    trigger('routeAnimation', [
                    state('*', style({transform: 'translateX(0)', opacity: 1})),
                    transition('void => *', [style({transform: 'translateX(-100%)', opacity: 0}),animate(500)]),
                    transition('* => void', animate(500, style({transform: 'translateX(100%)', opacity: 0})))
                    ])
                    ]
                    })
                    export class FirstComponent implements OnInit {

                    constructor() { }

                    ngOnInit() {

                    }

                    onStart($event) {
                    // call this function at start of the animation.
                    console.log('starting animation');
                    }

                    onDone($event) {
                    // call this function at the end of the animation.
                    console.log('the end of the animation');
                    }

                    }








                    share|improve this answer
























                    • It is an old post. Please try github.com/yohaneslumentut/ng-ripple-module . if someone still need an angular way in the future.

                      – yohanes
                      Jan 20 at 4:04
















                    0














                    Angular supported @animation.start and @animation.done to tap into animation events.



                    For example, you can use



                    (@routeAnimation.start)=onStart($event) and (@routeAnimation.done)=onDone($event) in your component.



                    You can find out more at Angular animations



                    Hope this help!



                    Example code:






                    import { Component, OnInit } from '@angular/core';
                    import { trigger, state, style, animate, transition } from '@angular/core';


                    @Component({
                    selector: 'app-first',
                    template: `
                    <div class="w9914420" [@routeAnimation]="show"
                    (@routeAnimation.start)="onStart($event)"
                    (@routeAnimation.done)="onDone($event)">
                    <h2>
                    first-component Works!
                    </h2>
                    </div>
                    `,
                    host: {
                    '[@routeAnimation]': 'true',
                    '[style.display]': "'block'",
                    '[style.position]': "'absolute'"
                    },
                    animations: [
                    trigger('routeAnimation', [
                    state('*', style({transform: 'translateX(0)', opacity: 1})),
                    transition('void => *', [style({transform: 'translateX(-100%)', opacity: 0}),animate(500)]),
                    transition('* => void', animate(500, style({transform: 'translateX(100%)', opacity: 0})))
                    ])
                    ]
                    })
                    export class FirstComponent implements OnInit {

                    constructor() { }

                    ngOnInit() {

                    }

                    onStart($event) {
                    // call this function at start of the animation.
                    console.log('starting animation');
                    }

                    onDone($event) {
                    // call this function at the end of the animation.
                    console.log('the end of the animation');
                    }

                    }








                    share|improve this answer
























                    • It is an old post. Please try github.com/yohaneslumentut/ng-ripple-module . if someone still need an angular way in the future.

                      – yohanes
                      Jan 20 at 4:04














                    0












                    0








                    0







                    Angular supported @animation.start and @animation.done to tap into animation events.



                    For example, you can use



                    (@routeAnimation.start)=onStart($event) and (@routeAnimation.done)=onDone($event) in your component.



                    You can find out more at Angular animations



                    Hope this help!



                    Example code:






                    import { Component, OnInit } from '@angular/core';
                    import { trigger, state, style, animate, transition } from '@angular/core';


                    @Component({
                    selector: 'app-first',
                    template: `
                    <div class="w9914420" [@routeAnimation]="show"
                    (@routeAnimation.start)="onStart($event)"
                    (@routeAnimation.done)="onDone($event)">
                    <h2>
                    first-component Works!
                    </h2>
                    </div>
                    `,
                    host: {
                    '[@routeAnimation]': 'true',
                    '[style.display]': "'block'",
                    '[style.position]': "'absolute'"
                    },
                    animations: [
                    trigger('routeAnimation', [
                    state('*', style({transform: 'translateX(0)', opacity: 1})),
                    transition('void => *', [style({transform: 'translateX(-100%)', opacity: 0}),animate(500)]),
                    transition('* => void', animate(500, style({transform: 'translateX(100%)', opacity: 0})))
                    ])
                    ]
                    })
                    export class FirstComponent implements OnInit {

                    constructor() { }

                    ngOnInit() {

                    }

                    onStart($event) {
                    // call this function at start of the animation.
                    console.log('starting animation');
                    }

                    onDone($event) {
                    // call this function at the end of the animation.
                    console.log('the end of the animation');
                    }

                    }








                    share|improve this answer













                    Angular supported @animation.start and @animation.done to tap into animation events.



                    For example, you can use



                    (@routeAnimation.start)=onStart($event) and (@routeAnimation.done)=onDone($event) in your component.



                    You can find out more at Angular animations



                    Hope this help!



                    Example code:






                    import { Component, OnInit } from '@angular/core';
                    import { trigger, state, style, animate, transition } from '@angular/core';


                    @Component({
                    selector: 'app-first',
                    template: `
                    <div class="w9914420" [@routeAnimation]="show"
                    (@routeAnimation.start)="onStart($event)"
                    (@routeAnimation.done)="onDone($event)">
                    <h2>
                    first-component Works!
                    </h2>
                    </div>
                    `,
                    host: {
                    '[@routeAnimation]': 'true',
                    '[style.display]': "'block'",
                    '[style.position]': "'absolute'"
                    },
                    animations: [
                    trigger('routeAnimation', [
                    state('*', style({transform: 'translateX(0)', opacity: 1})),
                    transition('void => *', [style({transform: 'translateX(-100%)', opacity: 0}),animate(500)]),
                    transition('* => void', animate(500, style({transform: 'translateX(100%)', opacity: 0})))
                    ])
                    ]
                    })
                    export class FirstComponent implements OnInit {

                    constructor() { }

                    ngOnInit() {

                    }

                    onStart($event) {
                    // call this function at start of the animation.
                    console.log('starting animation');
                    }

                    onDone($event) {
                    // call this function at the end of the animation.
                    console.log('the end of the animation');
                    }

                    }








                    import { Component, OnInit } from '@angular/core';
                    import { trigger, state, style, animate, transition } from '@angular/core';


                    @Component({
                    selector: 'app-first',
                    template: `
                    <div class="w9914420" [@routeAnimation]="show"
                    (@routeAnimation.start)="onStart($event)"
                    (@routeAnimation.done)="onDone($event)">
                    <h2>
                    first-component Works!
                    </h2>
                    </div>
                    `,
                    host: {
                    '[@routeAnimation]': 'true',
                    '[style.display]': "'block'",
                    '[style.position]': "'absolute'"
                    },
                    animations: [
                    trigger('routeAnimation', [
                    state('*', style({transform: 'translateX(0)', opacity: 1})),
                    transition('void => *', [style({transform: 'translateX(-100%)', opacity: 0}),animate(500)]),
                    transition('* => void', animate(500, style({transform: 'translateX(100%)', opacity: 0})))
                    ])
                    ]
                    })
                    export class FirstComponent implements OnInit {

                    constructor() { }

                    ngOnInit() {

                    }

                    onStart($event) {
                    // call this function at start of the animation.
                    console.log('starting animation');
                    }

                    onDone($event) {
                    // call this function at the end of the animation.
                    console.log('the end of the animation');
                    }

                    }





                    import { Component, OnInit } from '@angular/core';
                    import { trigger, state, style, animate, transition } from '@angular/core';


                    @Component({
                    selector: 'app-first',
                    template: `
                    <div class="w9914420" [@routeAnimation]="show"
                    (@routeAnimation.start)="onStart($event)"
                    (@routeAnimation.done)="onDone($event)">
                    <h2>
                    first-component Works!
                    </h2>
                    </div>
                    `,
                    host: {
                    '[@routeAnimation]': 'true',
                    '[style.display]': "'block'",
                    '[style.position]': "'absolute'"
                    },
                    animations: [
                    trigger('routeAnimation', [
                    state('*', style({transform: 'translateX(0)', opacity: 1})),
                    transition('void => *', [style({transform: 'translateX(-100%)', opacity: 0}),animate(500)]),
                    transition('* => void', animate(500, style({transform: 'translateX(100%)', opacity: 0})))
                    ])
                    ]
                    })
                    export class FirstComponent implements OnInit {

                    constructor() { }

                    ngOnInit() {

                    }

                    onStart($event) {
                    // call this function at start of the animation.
                    console.log('starting animation');
                    }

                    onDone($event) {
                    // call this function at the end of the animation.
                    console.log('the end of the animation');
                    }

                    }






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Jan 3 at 21:08









                    Mile MijatovicMile Mijatovic

                    1,1591225




                    1,1591225













                    • It is an old post. Please try github.com/yohaneslumentut/ng-ripple-module . if someone still need an angular way in the future.

                      – yohanes
                      Jan 20 at 4:04



















                    • It is an old post. Please try github.com/yohaneslumentut/ng-ripple-module . if someone still need an angular way in the future.

                      – yohanes
                      Jan 20 at 4:04

















                    It is an old post. Please try github.com/yohaneslumentut/ng-ripple-module . if someone still need an angular way in the future.

                    – yohanes
                    Jan 20 at 4:04





                    It is an old post. Please try github.com/yohaneslumentut/ng-ripple-module . if someone still need an angular way in the future.

                    – yohanes
                    Jan 20 at 4:04


















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54029701%2fhow-to-detect-when-ripple-has-finished-animating-in-angular-4%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Monofisismo

                    Angular Downloading a file using contenturl with Basic Authentication

                    Olmecas