Angular2 OrderBy Pipeline

When you start building an Angular2 application you quickly notice that you are not able to find the OrderBy filter (pipeline directive). For example in the first version of Angular we could do something like this:

<ul ng-repeat="friend in friends | filter:query | orderBy: 'name' "> <li>{{}}</li> </ul>

The reason for this appears to be that the orderby relies on reflection. One of Angular2 its goal is goal is to work with minifiers. And so they have been staying away from these kind of things since this will break the minification.

You can read Miško Hevery remark here on github:

How are we going to solve this obstacle? We build it our self!
Here is a very nice tutorial on how you can achieve this.

Are you to lazy to continue reading? No problem, grab the source code over here: