What is AngularJS Bootstrap And How To Use It Practically?

Mohammad waseem
Edureka
Published in
3 min readSep 13, 2019
AngularJS Bootstrap — Edureka

This AngularJS Bootstrap article will introduce you to the concept of Bootstrapping In AngularJS with a practical demonstration. Following pointers will be covered in this article,

  • Angular.bootstrap
  • Example 1
  • Example 2

Let us begin!!

Angular.bootstrap()

A functional component, known as the angular.bootstrap() function is present in the Core ng-model. It is used to manually start up the Angular application.

Syntax:

angular.bootstrap(element, [modules], [config])

Parameters:

  • element– DOM element is an element, which is considered to be the root of the angular application.
  • Modules– The array of modules to be loaded is known as modules. It is specified optionally.
  • Config– An object used for configuration options is known as Config. This too is optional.

Moving on with Angular Bootstrap example

Example:

<html>
<head>
<title>ANGULAR BOOTSTRAP EXAMPLE</title>
<script src=
"<a href="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js">https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js</a>">
</script>
<style>
.id
{
font-size: 1.5em;
color:blue;
}
</style>
</head>
<body ng-app="app" style="text-align:Center">
<h1 style="color:blue">Bootstrap</h1>
<h2>angular.bootstrap()</h2>
<div ng-controller="Bootstrap">
<span class="id">{{name}}</span>
is easy to use.
</div>
<script>
var app = angular.module("app", []);
app.controller('Bootstrap', ['$scope', function ($scope) {
$scope.name = "Bootstrap";
}]);
angular.bootstrap(document, ['app']);
</script>
</body>

Output:

Moving on with Angular Bootstrap example

Example2:

</div>
<html>
<head>
<title>angular.bootstrap()</title>
<script src=
"<a href="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js">https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js</a>">
</script>
</head>
<body ng-app="app" style="text-align:Center">
<h1 style="color:blue">Bootstrap</h1>
<h2>angular.bootstrap()</h2>
<div ng-controller="Bootstrap">
<div class="col-md-3 well" ng-init="count=0">
Rock:
<input type="radio" ng-model="Music" value="Rock"
ng-change="layout(Music)" />
Metal:
<input type="radio" ng-model="Music" value="Metal"
ng-change="layout(Music)" />
<pre><b>You selected:</b> {{result}} </pre>
</div>
</div>
<script>
var app = angular.module("app", []);
app.controller('Bootstrap', ['$scope', function ($scope) {
$scope.layout = function (Music) {
$scope.result = Music;
}
}]);
angular.bootstrap(document, ['app']);
</script>
</body>
</html>

Output:

On selecting the radio button, the following output is shown:

The angular.bootstrap() function provides a major control over the initialization of the application.

This brings us to the end of this article on AngularJS Bootstrap. If you wish to check out more articles on the market’s most trending technologies like Artificial Intelligence, Python, Ethical Hacking, then you can refer to Edureka’s official site.

Do look out for other articles in this series which will explain the various other aspects of Web Development.

1. ReactJS Tutorial

2. React Components

3. React Router v4 Tutorial

4. React Redux Tutorial

5. Angular Tutorial

6. Angular Directive Tutorial

7. Animating AngularJS Apps with ngAnimate Directive

8. PHP Tutorial

9. JQuery Tutorial

10. NodeJS Tutorial

11. Top 10 JavaScript Frameworks

12. Build a CRUD Application Using Node.js and MySQL

13. Build CRUD Application using Node.JS and MongoDB

14. Build REST API with Node.js

15. Best 3 Ways to Make Node.js Requests

16. HTML vs HTML5

17. What is REST API?

18. Flutter vs React Native

19. How To Dockerize a Node.js App?

Originally published at www.edureka.co on September 13, 2019.

--

--