Skip to content

Commit

Permalink
add orderby name for clubs
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Green committed Apr 17, 2016
1 parent 11b303d commit 521e50b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/pages/competition/clubList/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {IClub} from "../../../models/models.d.ts";
<label [text]="clubGroup.key" class="nx-header-title"></label>
</nx-header>
<nx-item *ngFor="#club of clubGroup.items">
<nx-item *ngFor="#club of clubGroup.items | orderBy:'Name'">
<ion-icon item-left icon="ion-clipboard"></ion-icon>
<label [text]="club.Name"></label>
<ion-icon item-right icon="ion-ios-people"></ion-icon>
Expand Down

4 comments on commit 521e50b

@jdalton
Copy link

@jdalton jdalton commented on 521e50b Apr 17, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use lodash and import just the methods you need

import {orderBy} from 'lodash/orderBy'

@matt4446
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jdalton - 👍 lodash ...
well here is the underscore implementation: https://github.com/matt4446/WhatsMyScore2-NativeScript/blob/master/app/pipes/orderBy.ts

import {orderBy} from 'lodash/orderBy'

the import is not sufficient as there are no typescript files in the node_module ... or am I missing something cool about TypeScript <-> JS?

I've added the typings file:
typings install lodash, which will globally give me Intellisense for _ (for lodash) which I can re-do the underscore version, but I'm curious how to use just import {orderBy} from 'lodash/orderBy'

I could just use: var orderBy = require("lodash/orderBy") but that will only give me type definition of any, which I would rather avoid and have typed version.

@jdalton
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a big user of TypeScript so not much help on that front.

@matt4446
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jdalton ok, no problem thanks for the suggestion. I'll have a play at some point (and I'll look at the performance differences). It looks like an easy conversion but I want to get more of the pages done for the moment. I'll come back to it.

Please sign in to comment.