feat(animations): expose the element
value within transition events
This commit is contained in:
@ -5,20 +5,23 @@
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import {ElementRef} from '../linker/element_ref';
|
||||
|
||||
import {AnimationPlayer} from './animation_player';
|
||||
import {AnimationTransitionEvent} from './animation_transition_event';
|
||||
|
||||
export class AnimationTransition {
|
||||
constructor(
|
||||
private _player: AnimationPlayer, private _fromState: string, private _toState: string,
|
||||
private _totalTime: number) {}
|
||||
private _player: AnimationPlayer, private _element: ElementRef, private _fromState: string,
|
||||
private _toState: string, private _totalTime: number) {}
|
||||
|
||||
private _createEvent(phaseName: string): AnimationTransitionEvent {
|
||||
return new AnimationTransitionEvent({
|
||||
fromState: this._fromState,
|
||||
toState: this._toState,
|
||||
totalTime: this._totalTime,
|
||||
phaseName: phaseName
|
||||
phaseName: phaseName,
|
||||
element: this._element
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import {ElementRef} from '../linker/element_ref';
|
||||
|
||||
/**
|
||||
* An instance of this class is returned as an event parameter when an animation
|
||||
@ -42,12 +43,19 @@ export class AnimationTransitionEvent {
|
||||
public toState: string;
|
||||
public totalTime: number;
|
||||
public phaseName: string;
|
||||
public element: ElementRef;
|
||||
|
||||
constructor({fromState, toState, totalTime, phaseName}:
|
||||
{fromState: string, toState: string, totalTime: number, phaseName: string}) {
|
||||
constructor({fromState, toState, totalTime, phaseName, element}: {
|
||||
fromState: string,
|
||||
toState: string,
|
||||
totalTime: number,
|
||||
phaseName: string,
|
||||
element: any
|
||||
}) {
|
||||
this.fromState = fromState;
|
||||
this.toState = toState;
|
||||
this.totalTime = totalTime;
|
||||
this.phaseName = phaseName;
|
||||
this.element = new ElementRef(element);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user