Open In App
Related Articles

How to make buttons using Angular UI Bootstrap ?

Improve Article
Improve
Save Article
Save
Like Article
Like

In this article, we will see how to make buttons 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.

Buttons directive is used for making buttons.

Syntax:

<buttonclass='btn btn-primary'>button</button>

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 a button with its UIBootStrap classes which will set the UI look for the buttons.
  • Now make different types of buttons using different classes and run the code.

Example:

HTML




<!DOCTYPE html>
<html ng-app="gfg">
  <head>
 
    <!-- Adding CDN scripts required for our page -->
    <script src=
    </script>
    <script src=
    </script>
    <script src=
    </script>
    <script src=
    </script>
 
    <script>
      // Adding Modules
      angular.module('gfg', ['ngAnimate', 'ngSanitize', 'ui.bootstrap']);
      angular.module('gfg').controller('button', function ($scope) {
        });
    </script>
    <link href=
          rel="stylesheet">
  </head>
  <body>
    <div ng-controller="button">
       
      <!-- Making a primary button -->
      <button class="btn btn-primary">Primary Button</button>
      <br>
      <br>
 
      <!-- Making a success button -->
      <button class="btn btn-success">Success Button</button>
      <br>
      <br>
 
      <!-- Making a default button -->
      <button class="btn btn-default">Default Button</button>
      <br>
      <br>
 
      <!-- Making a danger button -->
      <button class="btn btn-danger">Danger Button</button>
      <br>
      <br>
 
      <!-- Making a warning button -->
      <button class="btn btn-warning">Warning Button</button>
 
      <br>
      <br>
 
      <!-- Making a label primary button -->
      <label class="btn btn-primary">
        Primary Button using label
      </label>
    </div>
  </body>
</html>


Output:

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


Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 06 Jan, 2023
Like Article
Save Article
Previous
Next
Similar Reads
Complete Tutorials