0
* ngFor 지시문에서 사용자 주문 모듈을 도와주십시오. "^ 1.0.2"을 app.module.ts에서 사용 : * ngFor에서 역순으로 정렬하는 방법?
나는 "NGX 주문 파이프"를 설치import { OrderModule } from 'ngx-order-pipe';
...
..
@NgModule({
declarations: [
AppComponent
],
imports: [
OrderModule,
...
..
],
providers: [AgendaService],
bootstrap: [AppComponent]
})
export class AppModule { }
내 템플릿 :
<div class="line" *ngFor="let line of agenda | orderBy:'order'; let iLine = index">
<div class="left">
{{ line.start.trim() }} - {{ line.end.trim() }}
= {{line.order}}
</div>
</div>
그것은 일 (선은 오름차순으로 정렬 됨). 하지만 내림차순으로 정렬 된 선이 필요합니다.
나는 다음과 시도 :
<div class="line" *ngFor="let line of agenda | orderBy:'-order'; let iLine = index">
.....
</div>
을하지만 그렇지했습니다. 에 이것에 대해
*ngFor="let line of agenda | orderBy:'order':true; let iLine = index"
더 :
{{ collection | orderBy: expression : reverse }}
그래서
내림차순으로 사용하는, 당신은 두 번째 매개 변수를 사용할 필요가 다음 ngx-order-pipe
어떻게 작동하지 않았습니까? 당신은 무엇을 기대 했습니까? 실제로 어떤 이드가 발생합니까? –