feature-libs/cart/import-export/components/import-to-cart/import-entries/import-order-entries.component.ts
| changeDetection | ChangeDetectionStrategy.OnPush |
| selector | cx-import-order-entries |
| templateUrl | ./import-order-entries.component.html |
Properties |
|
Methods |
constructor(launchDialogService: LaunchDialogService, contextService: ContextService)
|
|||||||||
|
Parameters :
|
| openDialog | ||||||
openDialog(orderEntriesContext: OrderEntriesContext)
|
||||||
|
Parameters :
Returns :
void
|
| 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>