继续两个单独数组的索引顺序
Continue index order of two seperate arrays
我有一个包含“X”数组的对象(请注意它们可以更大或更小):
note: PONotes
allNotes: Array(6)
0: PONote {_text: "Contratación", _date: "", _author: ""}
1: PONote {_text: "Acordamos día de instalación con el técnico de Jazztel", _date: "", _author: ""}
2: PONote {_text: "Instalación y entrega de equipos. Ya puedes Navegar. Iniciamos la portabilidad de tu linea fija", _date: "", _author: ""}
3: PONote {_text: "Linea activada el día de tu portabilidad", _date: "", _author: ""}
4: PONote {_text: "Iniciamos la portabilidad de tu línea móvil", _date: "", _author: ""}
5: PONote {_text: "Introduce Nueva Sim el día de tu portabilidad", _date: "", _author: ""}
length: 6
__proto__: Array(0)
__proto__: Object
我使用以下函数将此对象分成两个数组:
private getOrderNotes(orderNotes: ProductOrderModel) {
this.activationDeadlinesGraphicViewModel.phoneNumberOrderNotes = orderNotes.note.getAllNotes()
.slice(0, this.activationDeadlinesGraphicViewModel.state);
this.activationDeadlinesGraphicViewModel.cellphoneNumberOrderNotes = orderNotes.note.getAllNotes()
.slice(-this.activationDeadlinesGraphicViewModel.type);
}
切片中的 state 和 type 为我提供了每个数组所需的项目数。
这是 this.activationDeadlinesGraphicViewModel.phoneNumberOrderNotes
的数组
(4) [PONote, PONote, PONote, PONote]
0: PONote {_text: "Contratación", _date: "", _author: ""}
1: PONote {_text: "Acordamos día de instalación con el técnico de Jazztel", _date: "", _author: ""}
2: PONote {_text: "Instalación y entrega de equipos. Ya puedes Navegar. Iniciamos la portabilidad de tu linea fija", _date: "", _author: ""}
3: PONote {_text: "Linea activada el día de tu portabilidad", _date: "", _author: ""}
length: 4
__proto__: Array(0)
这是 this.activationDeadlinesGraphicViewModel.cellphoneNumberOrderNotes
的数组
(2) [PONote, PONote]
0: PONote {_text: "Iniciamos la portabilidad de tu línea móvil", _date: "", _author: ""}
1: PONote {_text: "Introduce Nueva Sim el día de tu portabilidad", _date: "", _author: ""}
length: 2
__proto__: Array(0)
我必须在有序列表中打印它,第一个数组编号从 1 到 4,第二个数组编号从 5 到 6。
因为它们在单独的数组中,所以我打印索引并添加 +1,所以它不是从 0 开始的。对于第一个数组,它就像一个魅力,但由于第二个数组再次从 0 开始,我不知道如何更改基于最后一个数组我需要的下一个数字的索引。
<ng-container *ngFor="let phoneNumberOrderNotes of activationDeadlinesGraphicViewModel.phoneNumberOrderNotes; let i = index;">
<ion-row>
<ion-item>
<ion-col col-1>
<span [class.numberCircleFilled]="activationDeadlinesGraphicViewModel.baseType > i"
[class.numberCircleUnfilled]="activationDeadlinesGraphicViewModel.baseType <= i">
{{ i+1 }}
</span>
</ion-col>
<ion-col col-11>
<span>{{ phoneNumberOrderNotes.text }}</span>
</ion-col>
</ion-item>
</ion-row>
</ng-container>
<ng-container *ngFor="let cellphoneNumberOrderNotes of activationDeadlinesGraphicViewModel.cellphoneNumberOrderNotes; let i = index;">
<ion-row>
<ion-item>
<ion-col col-1>
<span [class.numberCircleFilled]="activationDeadlinesGraphicViewModel.baseType < i"
[class.numberCircleUnfilled]="activationDeadlinesGraphicViewModel.baseType >= i">
{{ i+1 }}
</span>
</ion-col>
<ion-col col-11>
<span>{{ cellphoneNumberOrderNotes.text }}</span>
</ion-col>
</ion-item>
</ion-row>
</ng-container>
最后两个应该是 5 和 6。
将 phoneNumberOrderNotes.length
添加到最后一个 i
以获得连续编号。
我有一个包含“X”数组的对象(请注意它们可以更大或更小):
note: PONotes
allNotes: Array(6)
0: PONote {_text: "Contratación", _date: "", _author: ""}
1: PONote {_text: "Acordamos día de instalación con el técnico de Jazztel", _date: "", _author: ""}
2: PONote {_text: "Instalación y entrega de equipos. Ya puedes Navegar. Iniciamos la portabilidad de tu linea fija", _date: "", _author: ""}
3: PONote {_text: "Linea activada el día de tu portabilidad", _date: "", _author: ""}
4: PONote {_text: "Iniciamos la portabilidad de tu línea móvil", _date: "", _author: ""}
5: PONote {_text: "Introduce Nueva Sim el día de tu portabilidad", _date: "", _author: ""}
length: 6
__proto__: Array(0)
__proto__: Object
我使用以下函数将此对象分成两个数组:
private getOrderNotes(orderNotes: ProductOrderModel) {
this.activationDeadlinesGraphicViewModel.phoneNumberOrderNotes = orderNotes.note.getAllNotes()
.slice(0, this.activationDeadlinesGraphicViewModel.state);
this.activationDeadlinesGraphicViewModel.cellphoneNumberOrderNotes = orderNotes.note.getAllNotes()
.slice(-this.activationDeadlinesGraphicViewModel.type);
}
切片中的 state 和 type 为我提供了每个数组所需的项目数。
这是 this.activationDeadlinesGraphicViewModel.phoneNumberOrderNotes
的数组(4) [PONote, PONote, PONote, PONote]
0: PONote {_text: "Contratación", _date: "", _author: ""}
1: PONote {_text: "Acordamos día de instalación con el técnico de Jazztel", _date: "", _author: ""}
2: PONote {_text: "Instalación y entrega de equipos. Ya puedes Navegar. Iniciamos la portabilidad de tu linea fija", _date: "", _author: ""}
3: PONote {_text: "Linea activada el día de tu portabilidad", _date: "", _author: ""}
length: 4
__proto__: Array(0)
这是 this.activationDeadlinesGraphicViewModel.cellphoneNumberOrderNotes
的数组(2) [PONote, PONote]
0: PONote {_text: "Iniciamos la portabilidad de tu línea móvil", _date: "", _author: ""}
1: PONote {_text: "Introduce Nueva Sim el día de tu portabilidad", _date: "", _author: ""}
length: 2
__proto__: Array(0)
我必须在有序列表中打印它,第一个数组编号从 1 到 4,第二个数组编号从 5 到 6。
因为它们在单独的数组中,所以我打印索引并添加 +1,所以它不是从 0 开始的。对于第一个数组,它就像一个魅力,但由于第二个数组再次从 0 开始,我不知道如何更改基于最后一个数组我需要的下一个数字的索引。
<ng-container *ngFor="let phoneNumberOrderNotes of activationDeadlinesGraphicViewModel.phoneNumberOrderNotes; let i = index;">
<ion-row>
<ion-item>
<ion-col col-1>
<span [class.numberCircleFilled]="activationDeadlinesGraphicViewModel.baseType > i"
[class.numberCircleUnfilled]="activationDeadlinesGraphicViewModel.baseType <= i">
{{ i+1 }}
</span>
</ion-col>
<ion-col col-11>
<span>{{ phoneNumberOrderNotes.text }}</span>
</ion-col>
</ion-item>
</ion-row>
</ng-container>
<ng-container *ngFor="let cellphoneNumberOrderNotes of activationDeadlinesGraphicViewModel.cellphoneNumberOrderNotes; let i = index;">
<ion-row>
<ion-item>
<ion-col col-1>
<span [class.numberCircleFilled]="activationDeadlinesGraphicViewModel.baseType < i"
[class.numberCircleUnfilled]="activationDeadlinesGraphicViewModel.baseType >= i">
{{ i+1 }}
</span>
</ion-col>
<ion-col col-11>
<span>{{ cellphoneNumberOrderNotes.text }}</span>
</ion-col>
</ion-item>
</ion-row>
</ng-container>
最后两个应该是 5 和 6。
将 phoneNumberOrderNotes.length
添加到最后一个 i
以获得连续编号。