VOOZH about

URL: https://www.geeksforgeeks.org/angular-js/how-to-open-popup-using-angular-and-bootstrap/

⇱ How to open popup using Angular and Bootstrap ? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to open popup using Angular and Bootstrap ?

Last Updated : 31 May, 2020
Adding Bootstrap to your Angular application is an easy process. Just write the following command in your Angular CLI. It will add bootstrap into your node_modules folder.
ng add @ng-bootstrap/ng-bootstrap
Approach: Import NgbModal module in the TypeScript file of the corresponding component, and then we have to write code for the popup model by using the above module in the HTML file of the corresponding component. Syntax:
  • In typescript file:
    import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
    
  • In html file:
    <ng-template #content let-modal>
     ...
    </ng-template>
    
Example: modal-basic.ts Now, we have to use ng-template to construct the model which will create a popup. Example: modal-basic.html Output: 👁 Image
👁 Image
Comment

Explore