- Why AngularJS?
- Understanding AngularJS
- An Overview of the AngularJS Life Cycle
- Separation of Responsibilities
- Integrating AngularJS with Existing JavaScript and jQuery
- Adding AngularJS to Your Environment
- Bootstrapping AngularJS in an HTML Document
- Using the Global APIs
- Creating a Basic AngularJS Application
- Using jQuery or jQuery Lite in AngularJS Applications
- Summary
Adding AngularJS to Your Environment
AngularJS is a client-side JavaScript library, which means the only thing you need to do to implement AngularJS in your environment is to provide a method for the client to get the angular.js library file by using a <script> tag in the HTML templates.
The simplest method of providing the angular.js library is to use the Content Delivery Network (CDN), which provides a URL for downloading the library from a third party. The downside of this method is that you must rely on a third party to serve the library, and if the client cannot connect to that third-party URL, your application will not work. For example, the following <script> tag loads the angular.js library from Google APIs CDN:
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.5/angular.min.js"> </script>
The other method of providing the angular.js library is to download it from the AngularJS website (http://angularjs.org) and use your own web server to serve the file to the client. This method takes more effort and also requires extra bandwidth on your web server; however, it might be a better option if you want more control over how the client obtains the library.