mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 20:33:32 +08:00
fix(toggle): initialize at ngAfterContentInit
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
import { NgZone, AfterViewInit, ChangeDetectorRef, Component, ElementRef, HostListener, Input, OnDestroy, Optional, Renderer, ViewEncapsulation } from '@angular/core';
|
import { AfterContentInit, NgZone, ChangeDetectorRef, Component, ElementRef, HostListener, Input, OnDestroy, Optional, Renderer, ViewEncapsulation } from '@angular/core';
|
||||||
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
||||||
|
|
||||||
import { Config } from '../../config/config';
|
import { Config } from '../../config/config';
|
||||||
@ -73,7 +73,7 @@ import { ToggleGesture } from './toggle-gesture';
|
|||||||
providers: [ { provide: NG_VALUE_ACCESSOR, useExisting: Toggle, multi: true } ],
|
providers: [ { provide: NG_VALUE_ACCESSOR, useExisting: Toggle, multi: true } ],
|
||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
})
|
})
|
||||||
export class Toggle extends BaseInput<boolean> implements IonicTapInput, AfterViewInit, OnDestroy {
|
export class Toggle extends BaseInput<boolean> implements IonicTapInput, AfterContentInit, OnDestroy {
|
||||||
|
|
||||||
_activated: boolean = false;
|
_activated: boolean = false;
|
||||||
_startX: number;
|
_startX: number;
|
||||||
@ -111,7 +111,7 @@ export class Toggle extends BaseInput<boolean> implements IonicTapInput, AfterVi
|
|||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
ngAfterViewInit() {
|
ngAfterContentInit() {
|
||||||
this._initialize();
|
this._initialize();
|
||||||
this._gesture = new ToggleGesture(this._plt, this, this._gestureCtrl, this._domCtrl);
|
this._gesture = new ToggleGesture(this._plt, this, this._gestureCtrl, this._domCtrl);
|
||||||
this._gesture.listen();
|
this._gesture.listen();
|
||||||
|
Reference in New Issue
Block a user