Next-generation platform

Adding a modal component

Complete the instructions provided to add a modal component.

Procedure

  1. Create an angular component in the extended single-spa application by running the following command.
    ng g c <modal-component-name>

    For example, if you are adding a modal that needs to be opened in PickOrderPageComponent of the shipment-backroom-pick application, create the modal component in the <store-temp>/packages/features/custom-shipment-backroom-pick/src/app/features/custom-shipment-backroom-pick/modals folder.

  2. Use the NgbModal service to open the component that you created in a window modal.

    The following sample code illustrates how to open a component in a window modal.

    
    import {TransferOrderAddTrackingNumberComponent} from '../transfer-order-add-tracking-number/transfer-order-add-tracking-number.component';
    import { NgbModal, NgbModalOptions } from '@ng-bootstrap/ng-bootstrap';
    @Injectable()
    export class  TransferOrderSummaryExtnRTConfig {
     constructor(private modalService: NgbModal,
                private nagModalService: ISFNagModalService,
        ) 
        public openAddTrackingNumberModal(entityModel, activeroute) {
              const modalRef = this.modalService.open(TransferOrderAddTrackingNumberComponent, {});
              modalRef.componentInstance.entityModel = entityModel;
              modalRef.result.then(data => {
              if (UIUtilsService.isNotVoid(data) && data['refreshParentScreen']) {
                this.relatedTasksService.sendMessage(true);
              }
              });
        } 
    }