Adding AngularJS to the Node.js Environment

AngularJS is a client-side JavaScript library, which means the only thing you need to do to implement AngularJS in your Node.js 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 Node.js to serve the file to the client. This method takes more effort and also requires extra bandwidth on your webserver; however, it may be a better option if you want more control over how the client obtains the library.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.151.220