OrderBy pipe issue
<p>I'm not able to translate this code from Angualr 1 to Angular 2:</p>



<pre class="lang-html prettyprint-override"><code>ng-repeat="todo in todos | orderBy: 'completed'"
</code></pre>

<p>This is what i've done following the Thierry Templier's answer:</p>

<p><strong>Component  template:</strong></p>



<pre class="lang-html prettyprint-override"><code>*ngFor="#todo of todos | sort"
</code></pre>

<p><strong>Component code:</strong></p>



<pre class="lang-js prettyprint-override"><code>@Component({
    selector: 'my-app',
    templateUrl: "./app/todo-list.component.html",
    providers: [TodoService],
    pipes: [ TodosSortPipe ]

})
</code></pre>

<p><strong>Pipe code:</strong></p>



<pre class="lang-js prettyprint-override"><code>import { Pipe } from "angular2/core";
import {Todo} from './todo';

@Pipe({
  name: "sort"
})
export class TodosSortPipe {
  transform(array: Array&lt;Todo&gt;, args: string): Array&lt;Todo&gt; {
    array.sort((a: any, b: any) =&gt; {
      if (a &lt; b) {
        return -1;
      } else if (a &gt; b) {
        return 1;
      } else {
        return 0;
      }
    });
    return array;
  }
}
</code></pre>

<p>I'm trying to sort an array of <code>Todo</code>s, ordered by the property <code>completed</code>. First <code>todo.completed = false</code> and then the <code>todo.complete = true</code>.</p>

<p>I don't understand very well the <code>transform</code> method and how to pass the arguments in that method and in the <code>sort</code> method.</p>

<p>What is the <code>args: string</code> argument? What are <code>a</code> and <code>b</code> and where they come from?</p>