File

feature-libs/cart/import-export/components/import-to-cart/import-entries/import-order-entries.component.ts

Metadata

changeDetection ChangeDetectionStrategy.OnPush
selector cx-import-order-entries
templateUrl ./import-order-entries.component.html

Index

Properties
Methods

Constructor

constructor(launchDialogService: LaunchDialogService, contextService: ContextService)
Parameters :
Name Type Optional
launchDialogService LaunchDialogService No
contextService ContextService No

Methods

openDialog
openDialog(orderEntriesContext: OrderEntriesContext)
Parameters :
Name Type Optional
orderEntriesContext OrderEntriesContext No
Returns : void

Properties

element
Type : ElementRef
Decorators :
@ViewChild('open')
orderEntriesContext$
Type : Observable<OrderEntriesContext | undefined>
Default value : this.contextService.get<OrderEntriesContext>(ORDER_ENTRIES_CONTEXT)
Protected subscription
Default value : new Subscription()
import {
  ChangeDetectionStrategy,
  Component,
  ElementRef,
  ViewChild,
} from '@angular/core';
import {
  ContextService,
  LaunchDialogService,
  LAUNCH_CALLER,
  OrderEntriesContext,
  ORDER_ENTRIES_CONTEXT,
} from '@spartacus/storefront';
import { Observable, Subscription } from 'rxjs';

@Component({
  selector: 'cx-import-order-entries',
  templateUrl: './import-order-entries.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ImportOrderEntriesComponent {
  protected subscription = new Subscription();
  @ViewChild('open') element: ElementRef;

  constructor(
    protected launchDialogService: LaunchDialogService,
    protected contextService: ContextService
  ) {}

  orderEntriesContext$: Observable<OrderEntriesContext | undefined> =
    this.contextService.get<OrderEntriesContext>(ORDER_ENTRIES_CONTEXT);

  openDialog(orderEntriesContext: OrderEntriesContext): void {
    this.launchDialogService.openDialogAndSubscribe(
      LAUNCH_CALLER.IMPORT_TO_CART,
      this.element,
      { orderEntriesContext }
    );
  }
}
<button
  *ngIf="orderEntriesContext$ | async as orderEntriesContext"
  class="link cx-action-link"
  (click)="openDialog(orderEntriesContext)"
>
  {{ 'importEntries.importProducts' | cxTranslate }}
</button>
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""