Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Refresh button change detection #1123

Merged
merged 3 commits into from
Mar 6, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Component, Input, animate, style, transition, trigger } from "@angular/core";
import {
ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, animate, style, transition, trigger,
} from "@angular/core";
import { autobind } from "@batch-flask/core";
import { Observable } from "rxjs";

Expand All @@ -20,20 +22,28 @@ export enum RefreshStatus {
]),
]),
],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class RefreshButtonComponent {
public statuses = RefreshStatus;

@Input()
public refresh: () => Observable<any>;
@Input() public refresh: () => Observable<any>;

@Input()
public type: string = "square";
@Input() public type: string = "square";

@Input()
public tooltipPosition: string = "above";
@Input() public tooltipPosition: string = "above";

public status = RefreshStatus.Idle;
public set status(status: RefreshStatus) {
this._status = status;
this.changeDetector.markForCheck();
}

public get status() { return this._status; }

private _status = RefreshStatus.Idle;

constructor(private changeDetector: ChangeDetectorRef) {
}

@autobind()
public onClick() {
Expand Down