June 2014
Intermediate to advanced
696 pages
38h 52m
English
Next, you need to implement a controller to support the webpage comments. Listing 27.17 shows the pageController code. Notice that commentSrv is also injected into this controller, along with the $http service.
The controller initializes $scope.page, makes an $http GET request to /pages, and passes the hard-coded "Photos Page" name as a parameter. The $scope.loadComments() function calls the commentSrv.getComment() function to retrieve the comments for the page by $scope.page.commentId. The callback function simply sets the $commentThread value that is used in the view.
The $scope.addReply() method is called when the user clicks Send in the page comments template. Notice that it first generates a newComment ...
Read now
Unlock full access