Implementing the Photo View

The photo view, shown in Listing 27.11, is the main view for the application in this example. It is loaded at the root route, /. The header of the view registers the <html> element with the AngularJS application and loads the comment_styles.css file. The <body> element is broken down into two main sections.

The upper section initializes the AngularJS ng-controller="photoController" to provide the functionality to interact with the photos from the webserver, including comments on photos. The lower section initializes ng-controller="photoController" to provide the functionality to interact with the webpage comments. You use two controllers to keep the scope separate because both are implementing comment sections.

The ...

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.