I have angular 8 application.
And I just want to show the text from api call in dialog mode.
So this is the api call in the component: FirstViewModalComponent
I have angular 8 application.
And I just want to show the text from api call in dialog mode.
So this is the api call in the component: FirstViewModalComponent
Add result of call to component property this.healthApiService.getWelcomePopupsByParticipant().subscribe(result => this.result);
Use it in view, html show with innerHtml binding and other properties with interpolation. Also you need to wrap template content so it won't render while results are undefined (Since you are making async call to backend I supose).
<app-modal [modalTitle]="modalTitle" [modalId]="modalId" (closeModal)="close.emit(false)">
<ng-container *ngIf="results; else loading">
<div class="modal modal-first-view">
<div class="modal-text modal-text-first-view" [innerHtml]="result.welcomePopupBody">
</div>
<div class="first-view-button-wrap">
<button (click)="buttonClicked()" type="button" class="button button-double-shadow button-first-view">
{{ result.welcomePopupButtonText }}
</button>
</div>
<div class="modal-img modal-img-first-view first-view-lady">
<img src="/assets/img/Woman-coach.png" alt="Nice lady here to help" />
</div>
</div>
</ng-container>
<ng-template #loading>
...Loading
</ng-template>
</app-modal>
You need to use *ngIf to ensure you access properties of result object after it was inicialized. Usage of ng-container and ng-template is just example.
jklhlkjlkj
",