@ngrx/store#Store TypeScript Examples

The following examples show how to use @ngrx/store#Store. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: theme.service.ts    From nica-os with MIT License 6 votes vote down vote up
constructor(private store$: Store<AppState>) {
    this.subs.push(
      this.appSettings$.pipe(
        first(),
        map(({theme}) => {
          this.setTheme(theme);
        })
      ).subscribe()
    );
  }
Example #2
Source File: find-book-page.component.ts    From router with MIT License 6 votes vote down vote up
constructor(private store: Store<fromBooks.State>) {
    this.searchQuery$ = store.pipe(
      select(fromBooks.selectSearchQuery),
      take(1)
    );
    this.books$ = store.pipe(select(fromBooks.selectSearchResults));
    this.loading$ = store.pipe(select(fromBooks.selectSearchLoading));
    this.error$ = store.pipe(select(fromBooks.selectSearchError));
  }
Example #3
Source File: app-loader.service.ts    From angular-dream-stack with MIT License 6 votes vote down vote up
createParentInjector(injector: Injector) {
    return Injector.create({
      providers: [
        {
          provide: Router,
          useValue: null,
        },
        {
          provide: Store,
          useValue: null,
        },
        {
          provide: EffectsRunner,
          useValue: null,
        },
        {
          provide: PlatformLocation,
          useClass: AppPlatformLocation,
          deps: [],
        },
      ],
      parent: injector,
    });
  }
Example #4
Source File: search.component.ts    From wingsearch with GNU General Public License v3.0 6 votes vote down vote up
constructor(
    private store: Store<{ app: AppState }>,
    private cookies: CookiesService,
    public dialog: MatDialog,
    private analytics: AnalyticsService
  ) {
    this.filteredBonusCards = this.store.select(({ app }) => app.activeBonusCards)
    this.bonusCards = this.store.select(({ app }) => app.bonusCards)
    this.query = {
      ...this.query,
      expansion: {
        originalcore: cookies.getCookie('expansion.core') !== '0',
        swiftstart: cookies.getCookie('expansion.swiftstart') !== '0',
        european: cookies.getCookie('expansion.european') !== '0',
        oceania: cookies.getCookie('expansion.oceania') !== '0',
      }
    }

    this.selectedExpansions = Object.entries(this.query.expansion).reduce((acc, entry) => entry[1] ? [...acc, entry[0]] : acc, [])
    store.dispatch(search(this.query))
  }
Example #5
Source File: app.component.ts    From ngrx-issue-tracker with MIT License 6 votes vote down vote up
constructor(private store: Store) {
    this.stats$ = this.store.select(fromIssue.selectStats);
    this.navigationLoading$ = this.store
      .select(fromNavigation.selectLoading)
      .pipe(
        // delay spinner deactivation, so we can see the spinner for a bit
        delayWhen((loading) => interval(loading ? 0 : 500))
      );
  }
Example #6
Source File: node.component.ts    From nuxx with GNU Affero General Public License v3.0 6 votes vote down vote up
constructor(private store: Store<AppState>, public rest: RestService, public dialog: MatDialog, private eventEmitterService: EventEmitterService) {
    const project = this.store.select('project')

    project.pipe(takeUntil(this.unSubscribe$)).subscribe((v) => {
      this.services = v.services

      setTimeout(() => {
        this.currentService = this.services.find((s: Service) => s.uuid === this.node.uuid)
      })
    })
  }
Example #7
Source File: header.component.ts    From digital-bank-ui with Mozilla Public License 2.0 6 votes vote down vote up
public constructor(
    private sidebarService: NbSidebarService,
    private menuService: NbMenuService,
    private themeService: NbThemeService,
    private layoutService: LayoutService,
    private breakpointService: NbMediaBreakpointsService,
    private rippleService: RippleService,
    private store: Store<fromRoot.State>,
  ) {
    this.materialTheme$ = this.themeService.onThemeChange().pipe(
      map(theme => {
        const themeName: string = theme?.name || '';
        return themeName.startsWith('material');
      }),
    );
  }
Example #8
Source File: settings.effects.ts    From enterprise-ng-2020-workshop with MIT License 6 votes vote down vote up
constructor(
    private actions$: Actions,
    private store: Store<State>,
    private router: Router,
    private overlayContainer: OverlayContainer,
    private localStorageService: LocalStorageService,
    private titleService: TitleService,
    private animationsService: AnimationsService,
    private translateService: TranslateService,
    private ngZone: NgZone
  ) {}
Example #9
Source File: app.component.ts    From nica-os with MIT License 5 votes vote down vote up
constructor(private store$: Store<any>) {
    gsap.registerPlugin(Draggable);
    this.loadApplications();
    this.loadFiles();
  }
Example #10
Source File: bucket.component.ts    From Angular-Cookbook with MIT License 5 votes vote down vote up
constructor(
    private bucketService: BucketService,
    private store: Store<AppState>
  ) {}
Example #11
Source File: base-auth.facade.ts    From svvs with MIT License 5 votes vote down vote up
constructor(private store: Store<IAuthStoreFeatureKey>) {
  }
Example #12
Source File: auth.service.ts    From ReCapProject-Frontend with MIT License 5 votes vote down vote up
constructor(
    private httpClient: HttpClient,
    private localStorageService: LocalStorageService,
    private store: Store<AppState>
  ) {}
Example #13
Source File: login-page.component.ts    From router with MIT License 5 votes vote down vote up
constructor(private store: Store<fromAuth.State>) {}
Example #14
Source File: auth.guard.ts    From dating-client with MIT License 5 votes vote down vote up
constructor(private store: Store<RootState>) { }
Example #15
Source File: datafeeder.facade.ts    From geonetwork-ui with GNU General Public License v2.0 5 votes vote down vote up
constructor(private store: Store<DatafeederState>) {}
Example #16
Source File: render-app.directive.ts    From angular-dream-stack with MIT License 5 votes vote down vote up
ngOnDestroy() {
    if (this.currentNgModuleRef) {
      this.currentNgModuleRef.injector.get(Store, null)?.complete();
      this.currentNgModuleRef.destroy();
      this.currentNgModuleRef = undefined;
    }
  }
Example #17
Source File: bird-card-detail.component.ts    From wingsearch with GNU General Public License v3.0 5 votes vote down vote up
constructor(
    @Inject(MAT_DIALOG_DATA) public data: { card: BirdCard },
    private store: Store<{ app: AppState }>,
    private sanitizer: DomSanitizer
  ) { }
Example #18
Source File: settings.component.ts    From ngrx-issue-tracker with MIT License 5 votes vote down vote up
constructor(private store: Store) {
    this.notificationPriority$ = this.store.select(
      fromNotification.selectPriority
    );
  }
Example #19
Source File: build-dialog.component.ts    From nuxx with GNU Affero General Public License v3.0 5 votes vote down vote up
constructor(public dialogRef: MatDialogRef<BuildDialogComponent>, private formBuilder: FormBuilder, @Inject(MAT_DIALOG_DATA) public data: Service, private store: Store, private eventEmitterService: EventEmitterService,) { }
Example #20
Source File: login.component.ts    From digital-bank-ui with Mozilla Public License 2.0 5 votes vote down vote up
constructor(private _loadingService: TdLoadingService, private formBuilder: FormBuilder, private store: Store<fromRoot.State>) {}