如何从angularfire2创建GeoPoint?

时间:2017-11-27 22:18:39

标签: angular firebase angularfire google-cloud-firestore

我正在尝试使用GeoPoint创建新的AngularFirestore,但我一直收到一条错误消息,指出该方法不可用。除了firebase之外,如何在不导入整个AngularFire npm模块的情况下执行此操作?

    import { Component, OnInit } from "@angular/core";
    import {AngularFirestore, AngularFirestoreCollection} from "angularfire2/firestore";
    @Component({
      selector: "app-firebase-menu-bar",
      templateUrl: "./firebase-menu-bar.component.html",
      styleUrls: ["./firebase-menu-bar.component.css"]
    })
    export class FirebaseMenuBarComponent {
      private itemsCollection: AngularFirestoreCollection<any>;
      private AngularFirestoreCollection;
      private draftCollection;
      private productionCollection;
      constructor(private db: AngularFirestore) {
        // this.production = db.collection('/production').snapshotChanges();
        this.db.firestore.GeoPoint(40, 100);
      }
    }

1 个答案:

答案 0 :(得分:0)

从5版开始

import { firestore } from 'firebase/firestore';
...
new firestore.GeoPoint ...

来自https://github.com/angular/angularfire2/issues/1604