angular / angularfire

Angular + Firebase = ❤️
https://firebaseopensource.com/projects/angular/angularfire2
MIT License
7.67k stars 2.19k forks source link

GeoPint is not implemented #1604

Closed saoron closed 6 years ago

saoron commented 6 years ago

Version info

Angular: 5.2.x

Firebase: ^4.8.2

AngularFire: 5.0.0-rc.7

Description

AngularFire doesn't have GeoPoint interface

Expected behavior

import { AngularFirestore, AngularFirestoreCollection } from 'angularfire2/firestore';

...

constructor(private db: AngularFirestore) {
    let point = new db.firestore.GeoPoint(32.5522, 34.556656)
}

Actual behavior

TypeError: Cannot read property 'GeoPoint' of undefined

More info

Firebase JS reference: https://firebase.google.com/docs/reference/js/firebase.firestore.GeoPoint

jamesdaniels commented 6 years ago

For the types, you should import from firebase.

import * as firebase from 'firebase/app'
...
let point = new firebase.firestore.GeoPoint(32.5522, 34.556656)
ahmed-eg commented 6 years ago

The jamesdaniels solution didn't work with me, any suggestions what might be the problem?

I'm getting error TypeError: Cannot read property 'GeoPoint' of undefined

I'm using: "angularfire2": "^5.0.0-rc.8.0", "firebase": "^5.0.2",

jamesdaniels commented 6 years ago

This is different in 5.0 now, you should do:

import { firestore } from 'firebase/firestore';
...
new firestore.GeoPoint ...
inorganik commented 6 years ago

You are correct, GeoPint is not implemented. 🍻

manunoly commented 5 years ago

I use this to make the GeoPoint work import { firestore } from 'firebase';

let point = new firestore.GeoPoint(32.5522, 34.556656);

jimmykane commented 5 years ago

Hi what is the recommended way to import these classes?

There are different answers here.

jimmykane commented 5 years ago

Hi @jamesdaniels I am confused.

What is the correct way to import?

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

does not work