【发布时间】:2016-12-15 10:13:54
【问题描述】:
在我的 Nativescript Angular 应用程序中,我使用的是 ActivityIndicator,按照我在 Nativescript Angular 文档(GroceryList 示例)中看到的设置:
<ActivityIndicator width="30" height="30" [busy]="refreshing" [visibility]="refreshing ? 'visible' : 'collapsed'" horizontalAlignment="center" verticalAlignment="center"></ActivityIndicator>
如果使用它的组件我有:
export class MyComponent {
public refreshing = false;
........
}
然后我从后端获取一些数据:
public onRefreshTap() {
console.log("onrefreshtap");
this.refreshing = true;
this.backend.getData(function (data) { //this.backend is my Service
this.refreshing = false;
})
}
问题是当我将 this.refreshing 设置为 true 时,ActivityIndicator 正确显示。但是当 bakend 请求完成时(所以,我把 this.refreshing=false)ActivityIndicator 不会隐藏......(而且它的忙属性似乎没有更新,它保持在旋转状态)..
我做错了什么?
提前致谢
【问题讨论】: