Skip to content
Related Articles

Related Articles

How to make alert using Angular UI Bootstrap ?

View Discussion
Improve Article
Save Article
  • Last Updated : 06 Jun, 2021

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.


<div uib-alert>alert</div>

Download AngularUI from the link:



  • First, add Angular UI bootstrap scripts needed for your project.

<script src=””></script>
<script src=””></script>
<script src=””></script>
<script src=””></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.



<!DOCTYPE html>
<html ng-app="gfg">
    <!-- Adding CDN scripts required for our page -->
    <script src=
    <script src=
    <script src=
    <script src=
    <link href=
        // Adding Modules
        angular.module('gfg', ['ngAnimate', 'ngSanitize', 'ui.bootstrap']);
        angular.module('gfg').controller('Alert', function ($scope) {
    <div ng-controller="Alert">
        <!-- Making a simple class using uib-alert -->
        <div uib-alert style="background-color:green;color:white">
            A Simple Alert
        <!-- Making a Warning Alert -->
        <div uib-alert ng-class="'alert-warning'">Warning Alert</div>
        <!-- Making a Danger Alert -->
        <div uib-alert ng-class="'alert-danger'">Danger Alert</div>
        <!-- Making a Success Alert -->
        <div uib-alert ng-class="'alert-success'">Success Alert</div>



My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!