From 01fdf21be0a353b331753c9244cec790559bac00 Mon Sep 17 00:00:00 2001 From: trickeyone Date: Tue, 29 Oct 2019 03:05:52 -0700 Subject: [PATCH] feat: added ability to cancel initial animation, closes #14 --- src/toggle.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/toggle.ts b/src/toggle.ts index 0c988be..d43f6ca 100644 --- a/src/toggle.ts +++ b/src/toggle.ts @@ -78,6 +78,13 @@ export class NgToggle implements AfterViewInit, AfterContentInit, AfterViewCheck * @type {boolean} */ @Input() @HostBinding('class.disabled') @HostBinding('class.ng-toggle-disabled') disabled: boolean = false; + /** + * Enable/Disable the toggle initial animations. Can help prevent unwanted animation display. + */ + @Input('disableInitialAnimation') + set outerAnimate(value: boolean) { + this._animate = !value; + } /** * @param {boolean} value @@ -323,7 +330,7 @@ export class NgToggle implements AfterViewInit, AfterContentInit, AfterViewCheck if (clearDragEnd) { this._dragEnd = null; } - if (this._innerAnimate) { + if (this._innerAnimate && !this._animate) { this._animate = true; } }