9951 explained code solutions for 126 technologies


angularjsHow can I use AngularJS and Bootstrap together to create a web application?


AngularJS and Bootstrap can be used together to create a web application. The following example code shows a simple AngularJS application that uses Bootstrap components:

<html>
  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  </head>
  <body ng-app="">
    <div class="container">
      <h1>My Web App</h1>
    </div>
  </body>
</html>

This code will create a simple webpage with a Bootstrap container and an H1 element.

Code explanation

  • <script> tag to include the AngularJS library from a CDN
  • <link> tag to include the Bootstrap library from a CDN
  • ng-app attribute to initialize the AngularJS application
  • <div> with class="container" to create a Bootstrap container
  • <h1> element to display a heading

Helpful links

Edit this code on GitHub