Skip to content

Commit

Permalink
fix(fab): not using change detection
Browse files Browse the repository at this point in the history
fixes #8424
  • Loading branch information
manucorporat committed Oct 6, 2016
1 parent 28661f6 commit 47e1e17
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 10 additions & 5 deletions src/components/fab/fab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Ion } from '../ion';

import { UIEventManager } from '../../util/ui-event-manager';
import { isTrueProperty } from '../../util/util';
import { nativeTimeout } from '../../util/dom';

/**
* @name FabButton
Expand Down Expand Up @@ -126,14 +127,13 @@ export class FabButton extends Ion {
*/
@Directive({
selector: 'ion-fab-list',
host: {
'[class.fab-list-active]': '_visible'
}
})
export class FabList {
_visible: boolean = false;
_fabs: FabButton[] = [];

constructor(private _elementRef: ElementRef, private _renderer: Renderer) { }

@ContentChildren(FabButton)
set _setbuttons(query: QueryList<FabButton>) {
let fabs = this._fabs = query.toArray();
Expand All @@ -150,18 +150,23 @@ export class FabList {
if (visible === this._visible) {
return;
}
this._visible = visible;

let fabs = this._fabs;
let i = 1;
if (visible) {
fabs.forEach(fab => {
setTimeout(() => fab.setElementClass('show', true), i * 30);
nativeTimeout(() => fab.setElementClass('show', true), i * 30);
i++;
});
} else {
fabs.forEach(fab => fab.setElementClass('show', false));
}
this._visible = visible;
this.setElementClass('fab-list-active', visible);
}

setElementClass(className: string, add: boolean) {
this._renderer.setElementClass(this._elementRef.nativeElement, className, add);
}

}
Expand Down
2 changes: 1 addition & 1 deletion src/util/ui-event-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export class UIEventManager {
}

function listenEvent(ele: any, eventName: string, zoneWrapped: boolean, option: any, callback: any): Function {
let rawEvent = ('__zone_symbol__addEventListener' in ele && !zoneWrapped);
let rawEvent = (!zoneWrapped && '__zone_symbol__addEventListener' in ele);
if (rawEvent) {
ele.__zone_symbol__addEventListener(eventName, callback, option);
return () => ele.__zone_symbol__removeEventListener(eventName, callback);
Expand Down

0 comments on commit 47e1e17

Please sign in to comment.