How to make Tabs using Angular UI Bootstrap ? - GeeksforGeeks

17 Jun, 2021
In this article we will see how to make Tabs 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.
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 tab with its UIBootStrap classes which will set the UI look for the tab.
Now make different types of tab using different classes and run the code.
 
Example 1: Making tabs with justified content.
HTML
<!DOCTYPE html><html ng-app="gfg">  <head>      <!-- Adding CDN scripts required for our page -->    <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>    <link href="https://netdna.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"           rel="stylesheet">    <script>      // Adding Modules      angular.module('gfg', ['ngAnimate', 'ngSanitize', 'ui.bootstrap']);      angular.module('gfg').controller('tab', function ($scope) {      });    </script>  </head>    <body>    <div ng-controller="tab"          style="padding: 10px; margin: 10px; border-style: double;">      <!-- making a tab -->      <uib-tabset active="activeJustified" justified="true">        <uib-tab index="0" heading="Column-1">          Column-1 Content        </uib-tab>        <uib-tab index="1" heading="Column-2">          Column-2 Content        </uib-tab>        <uib-tab index="2" heading="Column-3">          Column-3 Content        </uib-tab>      </uib-tabset>    </div>  </body></html>
Output:
Example 2:
HTML
<!DOCTYPE html><html ng-app="gfg">  <head>      <!-- Adding CDN scripts required for our page -->    <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>    <link href= "https://netdna.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"           rel="stylesheet">      <script>      // Adding Modules      angular.module('gfg', ['ngAnimate', 'ngSanitize', 'ui.bootstrap']);      angular.module('gfg').controller('tab', function ($scope) {      });    </script>  </head>    <body>    <div ng-controller="tab"          style="padding: 10px; margin: 10px; border-style: double;">        <!-- making a tab -->        <uib-tabset active="activePill" vertical="true" type="pills">            <uib-tab index="0" heading="Row-1">              Row-1 Content          </uib-tab>            <uib-tab index="1" heading="Row-2">              Row-2 Content          </uib-tab>            <uib-tab index="2" heading="Row-3">              Row-3 Content          </uib-tab>        </uib-tabset>    </div>  </body></html>
Output:
Reference: https://angular-ui.github.io/bootstrap/#!#Tabs
AngularUI-Bootstrap
AngularJS
Bootstrap
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Angular PrimeNG Dropdown Component
Angular PrimeNG Calendar Component
Angular 10 (blur) Event
Angular PrimeNG Messages Component
How to make a Bootstrap Modal Popup in Angular 9/8 ?
How to change navigation bar color in Bootstrap ?
Form validation using jQuery
How to pass data into a bootstrap modal?
How to align navbar items to the right in Bootstrap 4 ?
How to Show Images on Click using HTML ?