nativescript Listview未显示

时间:2017-02-13 12:10:31

标签: android nativescript angular2-nativescript

正在使用 nativescript版本2.5.0 。我的应用已在网络中成功运行。但在nativescript中它不会显示任何内容。

tns.html

<GridLayout rows="*">

<ListView [items]="views$ | async" (itemTap)="onClickView($event.view.bindingContext)">
  <template let-view="item">
    <Label [text]="view"></Label>
  </template>
</ListView>

</GridLayout>

component.ts

@Component({
moduleId: module.id,
selector: 'sd-list',
templateUrl: 'list.component.html',
styleUrls: ['list.component.css']
})
export class ListComponent implements OnInit {
public views$: Observable<any>;


constructor(private store: Store<IAppState>, private route: ActivatedRoute) {
console.log("Inside listcomonent"); -----> This console is working
this.views$ = store.let(getViews);

this.listType$ = store.let(getListType);
}
}

这就是我所拥有的。在我的Web应用程序中,列表视图中填充了值。但在本机脚本(android)的情况下,没有任何东西可以显示。我该怎么办?任何帮助都会非常有意义和有帮助。

1 个答案:

答案 0 :(得分:0)

也许这个问题与您设置Label的text属性的方式有关。您可以尝试以下代码<Label [text]="item.view"></Label>。 要获得进一步的帮助,您还可以查看示例here,其中显示了ListView和异步管道的简单示例。