O'Reilly logo

JavaScript JSON Cookbook by Ray Rischpater

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding a dependency to AngularJS to your web page

Just as another JavaScript framework, you need to include AngularJS in your HTML. As you'll see in this section, there are a few other things you do differently to get set up. First, be sure that you create a new HTML file, such as json-example-angular.html.

How to do it...

Here's the HTML for our application in its entirety:

<!doctype HTML> <html> <head> </head> <body ng-app="aprsapp"> <div ng-controller="AprsController"> <button ng-click="doAjax()">Send AJAX Request</button> <div>{{debug}}</div> <div>{{json}}</div> <br/> <div>{{message}}<div> </div> <p>Powered by <a href="http://www.aprs.fi">aprs.fi</a></p> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required