The Full AngularJS Application

Listing 27.18 shows the full AngularJS application code all together. Notice that line 1 defines the application and then the following code adds the commentSrv service, photoController, and pageController controllers.

Listing 27.18 comment_app.js: Implementing an AngularJS application that supports comments on webpages

01 var app = angular.module('myApp', []);02 function CommentObj($http) {03   this.getComment = function(commentId, callback){04     $http.get('/comments/get', {params: {commentId: commentId}})05       .success(function(data, status, headers, config) {06         callback(null, data);07       })08       .error(function(data, status, headers, config) {09         callback(data, ...

Get Node.js, MongoDB, and AngularJS Web Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.