Open In App

How to make alert using Angular UI Bootstrap ?

Last Updated : 06 Jun, 2021
Summarize
Comments
Improve
Suggest changes
Share
Like Article
Like
Report

In this article, we will see how to make alerts using Angular UI bootstrap. Angular UI Bootstrap is an Angular JS framework created by Angular UI developers for providing better UI which can be used easily.

Alerts directive is used for generating alerts from static and dynamic model data.

Syntax:

<div uib-alert>alert</div>

Download AngularUI from the link:

https://angular-ui.github.io/bootstrap
 

Approach: 

  • First, add Angular UI bootstrap scripts needed for your project.
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular-animate.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular-sanitize.js"></script> <script src="https://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-2.5.0.js"></script>
  • Make div with Alert's UIBootStrap classes which will make the UI look for the alert.
  • Now make different types of Alert using those classes and run the code.

Example:

Output:

Reference: https://angular-ui.github.io/bootstrap/#!#alert


Similar Reads