New to Angular and I have the need to open a detail view in a modal popup. I have not found much on the subject except for the answer to the question below therefore it may be a simple matter I am just over looking. I am not using ngxBootstrap.
Question: Load self in modal - Angular component
I have configured our Dashboard (sar-dashboard) to display a modal when the user clicks an element from a child component (sar-list) using the techniques found here: http://www.agiratech.com/angular-typescript-modal-window/
and using the EventEmitter as shown here: https://angular.io/guide/component-interaction#parent-listens-for-child-event
I have declared the modal in the dashboard HTML and included the event in the selector for the child component (sar-list)
<app-sar-list (openModal)="openModal($event)"></app-sar-list>
...
<div class="backdrop" [ngStyle]="{'display':display}"></div>
<div class="modal" tabindex="-1" role="dialog" [ngStyle]="{'display':display}">
The child (sar-list) declares the output event
@Output() openModal = new EventEmitter<number>();
and the parent (sar-dashboard) captures it to set the display: block so modal will show. This all works fine
openModal(id: number) { this.display = 'block'; }
What I need now is to grab the injected "id: number" so I can call the service and load details based on the id. I created a new component (sar-quickview) and add the selector to the modal however it renders first before the click event and therefore no data is ever loaded.
<div class="modal-body"><app-sar-quickview [id]="sarId"></app-sar-quickview></div>
How to load the detail from database once the modal is made visible based on user choice?
Note: this is my first post so I'm learning the formatting still.