From 29604d6d3daf36eec3a9c226c8e279d5cfdd1f1a Mon Sep 17 00:00:00 2001 From: Ibby Hadeed Date: Mon, 11 Sep 2017 09:56:07 -0400 Subject: [PATCH] Update README.md --- README.md | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index d5232669..b8624aee 100644 --- a/README.md +++ b/README.md @@ -52,38 +52,28 @@ import { NgZone } from '@angular/core'; @Component({ ... }) export class MyComponent { - constructor(private geolocation: Geolocation, private platform: Platform, private ngZone: NgZone) { + constructor(private geolocation: Geolocation, private platform: Platform) { platform.ready().then(() => { // get position geolocation.getCurrentPosition().then(pos => { - console.log(`lat: ${pos.coords.latitude}, lon: ${pos.coords.longitude}`) - }); // watch position const watch = geolocation.watchPosition().subscribe(pos => { - console.log(`lat: ${pos.coords.latitude}, lon: ${pos.coords.longitude}`) - - // Currently, observables from Ionic Native plugins - // need to run inside of zone to trigger change detection - ngZone.run(() => { - this.position = pos; - }) - + this.position = pos; }); // to stop watching watch.unsubscribe(); - }); - + } - + } ```