Skip to content

Instantly share code, notes, and snippets.

@trinhvanhuy
Created January 15, 2019 12:40
Show Gist options
  • Save trinhvanhuy/39d080e2a3bbf7bb2fc7e7f8c2975b56 to your computer and use it in GitHub Desktop.
Save trinhvanhuy/39d080e2a3bbf7bb2fc7e7f8c2975b56 to your computer and use it in GitHub Desktop.
Spinner - Loader Service
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