I am working on a University assignment to build a site in AngularJS using Australian Football League (AFL) data from the Squiggle API (api.squiggle.com) and one of the user stories asked me to show a list of predictions that your team will win. So, naturally I built a table. Being the overachiever I am, I wondered, “Is it possible to sort a few of the columns in the table?” Well, the answer was obviously yes. But was it an easy task?
Heck. NO.
Coming from a primarily React background, I tried to take a very React approach and that failed considerably. So, I turned to Google and boy was I unhappy. There were a lot of solutions out there but they were all for older versions of AngularJS. So, after a bit of time (and maybe some tears) making my way through the docs I figured it out and wanted to share it here with you all.
Before I get into this:
If you are an Angular developer PLEASE give feedback! For the sake of being honest with myself I won’t use any of it until after I submit my assignment but I will take it into account afterwards and implement any improvements. :)
ALSO… This is just my understanding of how these pieces fit together. Don’t just take my word for it! Checkout the docs at angular.io and learnrxjs.io!
Now onto the main show…
First let’s get the latest AngularJS CLI:
npm install -g @angular/cli
Next we want to create a simple project to test this out in using the ng
CLI command:
ng new table-sorter-app
#frontend #angularjs #angular