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.
This video covers the following topics:
* Adding dynamic urls for each page of our pagination
To do this we’ll complete the following tasks:
* Adding a query parameter to the ‘url’ property of our ‘top’ state: ‘/top?page’
* Adding a default state to our application using $urlRouterProvider
* Injecting $stateParams into our TopStoriesController
* Adding a currentPage property to our TopStoriesController’s scope and setting it equal to the value of $stateParams.page or 1 if there is no parameter passed
* Adding the current-page option to our dir-paginate list item and setting it equal to currentPage
* Initializing the vm.start property with a value based on the currentPage which we derive from the URL:
vm.start = 30 * ($scope.currentPage – 1) + 1;