File
Metadata
| changeDetection |
ChangeDetectionStrategy.OnPush |
| selector |
cx-return-order |
| templateUrl |
./return-order.component.html |
|
entries$
|
Type : Observable<OrderEntry[]>
|
Default value : this.orderAmendService.getEntries()
|
|
|
|
form$
|
Type : Observable<FormGroup>
|
Default value : this.orderAmendService
.getForm()
.pipe(tap((form) => (this.orderCode = form.value.orderCode)))
|
|
|
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { OrderEntry } from '@spartacus/core';
import { Observable } from 'rxjs';
import { tap } from 'rxjs/operators';
import { OrderAmendService } from '../../amend-order.service';
@Component({
selector: 'cx-return-order',
templateUrl: './return-order.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ReturnOrderComponent {
orderCode: string;
form$: Observable<FormGroup> = this.orderAmendService
.getForm()
.pipe(tap((form) => (this.orderCode = form.value.orderCode)));
entries$: Observable<OrderEntry[]> = this.orderAmendService.getEntries();
constructor(protected orderAmendService: OrderAmendService) {}
}
<ng-container *ngIf="form$ | async as form">
<ng-container *ngTemplateOutlet="actions"></ng-container>
<cx-amend-order-items *ngIf="entries$ | async as entries" [entries]="entries">
</cx-amend-order-items>
<cx-form-errors
aria-live="assertive"
aria-atomic="true"
[control]="form.get('entries')"
></cx-form-errors>
<ng-container *ngTemplateOutlet="actions"></ng-container>
<ng-template #actions>
<cx-amend-order-actions
*ngIf="orderCode"
[orderCode]="orderCode"
[amendOrderForm]="form"
backRoute="orderDetails"
forwardRoute="orderReturnConfirmation"
></cx-amend-order-actions>
</ng-template>
</ng-container>
Legend
Html element with directive