Aggiunta di un componente modale
Completare le istruzioni fornite per aggiungere un componente modale.
Procedura
- Creare un componente angolare nell'applicazione spa singola estesa immettendo il seguente comando.
ng g c <modal-component-name>Ad esempio, se si sta aggiungendo un modale che deve essere aperto in
PickOrderPageComponentdell'applicazioneshipment-backroom-pick, creare il componente modale nella cartella <store-temp>/packages/features/custom-shipment-backroom-pick/src/app/features/custom-shipment-backroom-pick/modals . - Utilizzare il servizio
NgbModalper aprire il componente creato in una finestra modale.Il seguente codice di esempio illustra come aprire un componente in una finestra modale.
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); } }); } }