Cant find syntax error


I’m trying to make pip in order to sort items in cols, according to this tutorial:

What ist wrong with these lines?
I get following error:
Expression expected at the ?

return input.sort(function(a:any,b:any){
return !desc ?
? OrderBy._orderByComparator(a[property], b[property])
: -OrderBy._orderByComparator(a[property], b[property]);

Thanks a lot!

Looks like you’ve added a double question mark in your ternary operator:

!desc ? <- first one
? <- second one OrderBy._orderByComparator(a[property], b[property])
: -OrderBy._orderByComparator(a[property], b[property]);```

Oh, sorry. All right! Thank you.

Please, help me once again:
I did the following

  <ion-item-sliding *ngFor="let item of items  | orderBy : 'name'">
    <ion-item >

I get “Cannot read property ‘toLowerCase’ of undefined”

Can you tell me why? Thanks a lot!!!

A pipe is the wrong choice here. Please read this (all the way to the end) for more details and what you should be doing instead.

@rapropos and @SigmundFroyd and all others
Ok, thank you. I think, I have understood the use of pipes.
But I still have my problem with my original plan: I have a table, respectively a grid-construction, with three columns, with header named colA, colB, colC. I “just” want to order my rows asc/desc by klicking on the single headers.
I hope I do not sound rude, but could someone give me a sample code for that? How big would be the effort. What would that cost me? I’m really desperate!
Thank you very much!

I found this tutorial:

It works fine!