how to write data in firebase with ionic?

0

I have an application that displays on the screen the latitude and longitude wanted to know how to write this data in firebase

My code home.ts ta so

import { Component } from '@angular/core';

import {NavController, Platform} from 'ionic-angular'; import {Geolocation, GeolocationOptions, Geoposition} from '@ ionic-native / geolocation';

@Component ({     selector: 'page-home',     templateUrl: 'home.html' }) export class HomePage {

geoposition: Geoposition

geolocationOptions: GeolocationOptions
    constructor(private platform: Platform, 
        private geolocation: Geolocation,
        public navCtrl: NavController){
        }

    async getGeolocation(){
        await this.platform.ready();

        try {

            this.geolocationOptions = {
                maximumAge: 1000,
                timeout: 1000,
                enableHighAccuracy: true
            }

            this.geoposition = await this.geolocation.getCurrentPosition(this.geolocationOptions);
        }
        catch(e){
            console.error(e)
        }

    }

}

the html that displays the data on the screen

 <ion-list>
                        <ion-item>
                            Accurary: {{geoposition.coords.accuracy}}
                        </ion-item>
                        <ion-item>
                            Latitude: {{geoposition.coords.latitude}}
                        </ion-item>
                        <ion-item>
                            Longitude: {{geoposition.coords.longitude}}
                        </ion-item>
                        <ion-item>
                            Timestamp:{{geoposition.timestamp |date}}
                        </ion-item>
    
asked by anonymous 01.12.2018 / 00:51

1 answer

0

The use of Firebase on Ionic can be done using Angular.

Follow a cool tutorial to implement a crud with AngularFire2

link

    
01.12.2018 / 20:01