Skip to content

Commit

Permalink
Step 5: Finalize Animation Trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
Can Kattw committed Oct 7, 2016
1 parent deb14f5 commit 8cf6c64
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ <h1>
{{title}}
</h1>

<app-animation-target></app-animation-target>
<app-animation-target [@wobble]="wobbleState" (@wobble.done)="reset()"></app-animation-target>

<button (click)="triggerAnimation()">Click to Trigger the Animation</button>
10 changes: 8 additions & 2 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Component, trigger, keyframes, animate, transition, style} from '@angular/core';
import {Component, trigger, keyframes, animate, transition, style, NgZone} from '@angular/core';

@Component({
selector: 'app-root',
Expand All @@ -22,11 +22,17 @@ export class AppComponent {
title = 'app works!';
public wobbleState: string;

triggerAnimation() {
constructor(public zone: NgZone) {
}

triggerAnimation() {
this.wobbleState = "active";
}

reset() {
this.zone.run(() => {
this.wobbleState = "inactive";
});
}

}

0 comments on commit 8cf6c64

Please sign in to comment.