How to use the @ngrx/store.select function in @ngrx/store

To help you get started, we’ve selected a few @ngrx/store examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DeborahK / Angular-NgRx-GettingStarted / APM-Demo5 / src / app / products / containers / product-shell / product-shell.component.ts View on Github external
ngOnInit(): void {
    this.store.dispatch(new productActions.Load());
    this.products$ = this.store.pipe(select(fromProduct.getProducts));
    this.errorMessage$ = this.store.pipe(select(fromProduct.getError));
    this.selectedProduct$ = this.store.pipe(select(fromProduct.getCurrentProduct));
    this.displayCode$ = this.store.pipe(select(fromProduct.getShowProductCode));
  }
github graycoreio / daffodil / libs / category / src / selectors / category.selector.spec.ts View on Github external
it('selects the selected categoryId state', () => {
      const selector = store.pipe(select(selectCategoryPageConfigurationState));
      const expected = cold('a', { a: stubCategoryPageConfigurationState });
      expect(selector).toBeObservable(expected);
    });
  });
github syndesisio / syndesis / app / ui-angular / src / app / customizations / api-connector / api-connector-create / api-connector-create.component.ts View on Github external
ngOnInit() {
    this.modalService.registerModal(
      this.cancelModalId,
      this.cancelModalTemplate
    );

    this.loading$ = this.apiConnectorStore.pipe(select(getApiConnectorLoading));
    this.currentActiveStep$ = this.apiConnectorStore.pipe(select(getApiConnectorWizardStep));
    this.uploadSpecification$ = this.apiConnectorStore.pipe(select(getApiConnectorUploadSpecification));
    this.validationErrors$ = this.apiConnectorStore.pipe(select(getApiConnectorValidationError));
    this.specificationForEditor$ = this.apiConnectorStore.pipe(select(getApiConnectorSpecificationForEditor));
    this.createRequest$ = this.apiConnectorStore.pipe(select(getApiConnectorRequest));
    this.showApiEditor$ = this.apiConnectorStore.pipe(select(getShowApiEditor));
    this.apiConnectorState$ = this.apiConnectorStore.pipe(select(getApiConnectorState));

    this.nav.hide();
  }
github kubernetes-sigs / release-notes / src / app / filter / filter.component.ts View on Github external
ngOnInit() {
    this.store.pipe(select(getAllNotesSelector)).subscribe(notes => {
      if (notes) {
        this.notes = notes;
        this.updateOptions();
      }
    });

    this.store.pipe(select(getFilterSelector)).subscribe(filter => {
      if (filter) {
        this.filter = filter;
      }
    });

    this.store
      .pipe(select(getSettingsSelector))
      .pipe(skip(1))
      .subscribe(settings => {
        this.settings = settings;
        this.updateOptions();
      });
  }
github bwsw / cloudstack-ui / src / app / template / containers / iso-attachment-filter-selector.container.ts View on Github external
[groups]="groups$ | async"
      [fetching]="isLoading$ | async"
      [(selectedTemplate)]="selectedTemplate"
      (selectedTemplateChange)="selectedTemplateChange.emit($event)"
      (selectedTypesChanged)="onSelectedTypesChange($event)"
      (selectedOsFamiliesChanged)="onSelectedOsFamiliesChange($event)"
      (selectedGroupsChanged)="onSelectedGroupsChange($event)"
      (queryChanged)="onQueryChange($event)"
    >
  `,
})
export class IsoAttachmentFilterSelectorContainerComponent implements AfterViewInit {
  readonly isos$ = this.store.pipe(select(fromTemplates.selectTemplatesForIsoAttachment));
  readonly isLoading$ = this.store.pipe(select(fromTemplates.isLoading));
  readonly groups$ = this.store.pipe(select(configSelectors.get('imageGroups')));
  readonly viewMode$ = this.store.pipe(select(fromTemplates.vmCreationListViewMode));
  readonly selectedTypes$ = this.store.pipe(select(fromTemplates.vmCreationListSelectedTypes));
  readonly selectedOsFamilies$ = this.store.pipe(
    select(fromTemplates.vmCreationListSelectedOsFamilies),
  );
  readonly selectedGroups$ = this.store.pipe(select(fromTemplates.vmCreationListSelectedGroups));
  readonly query$ = this.store.pipe(select(fromTemplates.vmCreationListQuery));

  @Input()
  public selectedTemplate: BaseTemplateModel;
  @Output()
  public selectedTemplateChange = new EventEmitter();

  public groupings = [
    {
      key: 'zones',
      label: 'GROUP_BY_ZONES',
github typebytes / angular-checklist / src / app / checklist / search / search.service.ts View on Github external
private getStoreData() {
    return zip(
      this.store.pipe(select(ChecklistSelectors.getActiveCategoryEntities)),
      this.store.pipe(select(AppSelectors.getItemEntities)),
      this.store.pipe(select(ProjectsSelectors.getSelectedProjectId))
    ).pipe(take(1));
  }
github intershop / intershop-pwa / src / app / core / services / basket / basket-payment.service.ts View on Github external
return throwError('setBasketPayment() called without paymentInstrument');
    }

    return this.apiService
      .put<{ data: PaymentInstrument; included: { paymentMethod: { [id: string]: PaymentMethodBaseData } } }>(
        `baskets/${basketId}/payments/open-tender?include=paymentMethod`,
        { paymentInstrument },
        {
          headers: this.basketHeaders,
        }
      )
      .pipe(
        map(({ data, included }) =>
          data && data.paymentMethod && included ? included.paymentMethod[data.paymentMethod] : undefined
        ),
        withLatestFrom(this.store.pipe(select(getCurrentLocale))),
        concatMap(([pm, currentLocale]) =>
          this.sendRedirectUrlsIfRequired(pm, paymentInstrument, basketId, currentLocale && currentLocale.lang)
        )
      );
  }
github SAP / cloud-commerce-spartacus-storefront / projects / core / src / checkout / facade / checkout-payment.service.ts View on Github external
getCardTypes(): Observable {
    return this.checkoutStore.pipe(select(CheckoutSelectors.getAllCardTypes));
  }