[英]Nativescript Angular *ngFor first item at last
我不知道怎么回事。 下一个和第一个索引正确。 我试图用javascript对数组进行排序。
@ angular / core:4.1.0 nativescript-angular:3.1.3打字稿:2.4.0
1234
2341
<Label
*ngFor="let item of references; let i = index; let last = last;"
[text]="item.Number"></Label>
references = [
{
"NodeId":2259,
"Number":1,
"Details":"",
"Url":""
},
{
"NodeId":7534,
"Number":2,
"Details":"",
"Url":""
},
{
"NodeId":3585,
"Number":3,
"Details":"",
"Url":"http://www.ncbi.nlm.nih.gov/pubmed/18489970"
},
{
"NodeId":7535,
"Number":4,
"Details":"",
"Url":"http://www.ncbi.nlm.nih.gov/pubmed/9701682"
}
]
这不做任何排序,
<Label
*ngFor="let item of references; let i = index; let last = last;"
[text]="item.Number"></Label>
为了排序,您需要创建一个管道
尝试将*ngFor
移动到包装的<StackLayout>
,这样:
<StackLayout *ngFor="let item of references">
<Label [text]="item.Number">
</StackLayout>
不要问为什么这样做有效,但是可能可行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.