Home Hacker News Hacker News Clone in AngularJS – Post 5, Part E: Adding All Related Comments to Post Show Page

Hacker News Clone in AngularJS – Post 5, Part E: Adding All Related Comments to Post Show Page

4
0

Building a Hacker News Clone in AngularJS – Part 5

Hi Everyone! I’m Dakota Lee Martinez. In this video series I’ll be using the Hacker News API to build out a Hacker News Clone in AngularJS.

These videos are accompanied by a series of blog posts at becomingaprogrammer.com. You can find the written explanation of the process and code samples there.

Building a Hacker News Clone in AngularJS – Part 5

In this video, we’re going to … make sure that we’re displaying all of the comments related to a particular post by adding an ng-repeat.

To do this, this video covers the following topics:

* adding vm.comments to the StoryController and setting it equal to the value of the “kids” property retrieved from the Hacker News API’s reponse data.
* adding {{ vm.comments }} to the story-comments.html view to display the array of comment IDs
* checking http://localhost:8080/#/post?id=1 to make sure that the array is passed to the view
* using an ng-repeat to loop through vm.comments and pass each id into a story-comment component within each list item.
* checking http://localhost:8080/#/post?id=1 again to see that we now have all the comments related to the 1st post on Hacker News.

source

LEAVE YOUR COMMENT

Your email address will not be published. Required fields are marked *

WordPress Anti Spam by WP-SpamShield

Close

Powered by moviekillers.com