Angular5:无法获取firebase对象

时间:2018-04-24 13:08:52

标签: angular firebase

我刚在firebase控制台中创建了一个示例firebase对象,我想在我的typescrip中获取该对象。我按照http://www.dotnetmob.com/angular-5-tutorial/angular-5-crud-operations-with-firebase/中的步骤进行操作。但没有运气。有人可以帮我这个吗?

这是我的目标:    enter image description here

constructor(private db :AngularFireDatabase) {
    let item:any = db.list('OAuth');
    console.log("_____________", item);
}

我失踪了什么。我在浏览器控制台中获取输出如下:

enter image description here

1 个答案:

答案 0 :(得分:0)

您可以通过访问数据 class Repository(private val networkManager: NetworkManager) { private var allObjectsJob: Job? = null fun getAllObjects(forceReload: Boolean = false) { allObjectsJob = launch { try { val objects = networkManager.getAllObjects().await().filterNotNull() // e.g. put all objects in map } catch (e: HttpException) { // error handling } } } fun getObject(id: String) { launch { if (allObjectsJob != null && allObjectsJob!!.isActive) { allObjectsJob!!.join() } // e.g. get object from map } } }