【发布时间】:2018-04-30 02:48:42
【问题描述】:
我有一个任务管理应用程序,我不希望用户 能够在每个任务部分中看到他们的任务,就像在照片中一样:Click here to see the photo
我可以从数据库中获取数据并以 JSON 格式打印出来,如您在照片中将其标记为 “从数据库中获取任务”,但问题是我不能像 “仅限演示” 一样显示它,您可以在照片中看到。
我正在使用 angularfire2 从 firebase 实时数据库中获取数据。
这里是数据的控制台:The console of the data
以下是提供者的代码:
getTaskSectionAndTaskList(projBoardKey) {
this.taskSectNTaskListRef = this.afDatabase.list('taskSection/' + projBoardKey);
return this.taskSectNTaskListRef;
}
以下是 .ts 文件中的代码:
...
taskList$: Observable<Task[]>;
constructor(..., private tasksecProvider: TasksectionProvider) {
...
this.taskList$ = this.tasksecProvider.getTaskSectionAndTaskList(this.selectedBoardKey)
.snapshotChanges()
.map(changes => {
return changes.map(c => ({
key: c.payload.key,
...c.payload.val()
}));
});
}
以下是 HTML 文件的代码:
<div *ngFor="let taskSectionList of taskList$ | async">
<ion-slide>
<ion-card>
<ion-card-header>
<p class="task-section-title">{{ taskSectionList.taskSectionTitle }}</p>
</ion-card-header>
<ion-card-content>
<div>
<div class="for-demo-only">
<div>
<p>Task Name</p>
</div>
</div>
<div>
{{ taskSectionList.task | json }}
</div>
</div>
</ion-card-content>
<ion-card>
</ion-slide>
</div>
【问题讨论】:
标签: ionic-framework ionic3 angularfire2 angularfire5