For those familiar with TypeScript, you may already know about typeguards and how useful they can be. If you are not familiar with typeguards, i’d recommend checking them out. There are plenty of guides and resources available on the topic:

While there are many great resources already available, most of the examples given deal with pretty small data structures or only deal with the validity of one field.

At my current place of employment, we use typeguards heavily to verify that API responses are what we expect them to be and that objects are of the right…


So I just spent about four hours trying to figure out how to build an Angular table with a working sort header… I figured I’d post a quick tutorial/guide here in an attempt to save y’all some headache.

My requirements…

  • Build a table with Angular 5’s data table component.
  • Make sure the data in the table was sortable with Angular 5’s sort header.
  • Request data from a server and load it into the table (the tricky part).

Steps

  • Follow the Angular Material guide for putting together a data table with a sort header
  • Implement a custom DataSource class using BehaviorSubject
  • Link the custom data source to the table
  • Implement custom sorting method
  • Link sorting method to data table and publish new sorted data to the data subject

And the most valuable bit… Some example code

Hope this helps!


Thoughts While Biking 60 Miles

Ever wonder what goes through one’s mind while riding 60 miles on a trainer?
Well, here’s your chance to find out.

Preparation

I pulled myself out of bed at about 11:30am. I knew that I needed to go to the bike shop to get a bike computer and that I needed to eat a decent amount of food before I started riding.

For breakfast

By about 3pm, I had the new bike computer all set up and ready to go and I was ready to get started. …

Austin Mueller

Entrepreneur, Real Estate Investor, Programmer. On a never ending quest for knowledge.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store