Created
January 15, 2019 12:40
-
-
Save trinhvanhuy/39d080e2a3bbf7bb2fc7e7f8c2975b56 to your computer and use it in GitHub Desktop.
Spinner - Loader Service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import * as globalAction from '@actions/global.action'; | |
import * as fromRoot from '@core/reducers'; | |
import { Store } from '@ngrx/store'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class LoaderService { | |
constructor( | |
public store: Store<fromRoot.AppState> | |
) {} | |
show() { | |
this.store.dispatch(new globalAction.ShowSpinner()); | |
} | |
hide() { | |
this.store.dispatch(new globalAction.HideSpinner()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment