मैं अपने आयनिक 2 हैलो वर्ल्ड प्रोजेक्ट में भौगोलिक स्थान का उपयोग करने की कोशिश कर रहा हूं, और official site पर निर्देश के बाद मैं आयनिक प्लगइन "जिओलोकेशन" जोड़ता हूं।आयनिक भौगोलिक स्थान प्लगइन त्रुटि: "जिओलोकेशन के लिए कोई प्रदाता नहीं"
मैं इन दोनों आदेशों को चलाने की है:
$ ionic plugin add cordova-plugin-geolocation
$ npm install --save @ionic-native/geolocation
और ये मेरे home.ts है:
EXCEPTION: Error in ./TabsPage class TabsPage - inline template:0:0 caused by: No provider for Geolocation!
error_handler.js:56ORIGINAL EXCEPTION: No provider for Geolocation!
:
import { Component } from '@angular/core';
import {Geolocation} from '@ionic-native/geolocation'
import { NavController } from 'ionic-angular';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
map:any=null;
geoInfo:any={
resp:'',
data:''
};
constructor(
public navCtrl: NavController,
private geolocation: Geolocation
) {
}
test(){
this.geolocation.getCurrentPosition().then((resp) => {
this.geoInfo.resp=JSON.stringify(resp);
// resp.coords.latitude
// resp.coords.longitude
}).catch((error) => {
console.log('Error getting location', error);
this.geoInfo.resp='Error getting location';
});
let watch = this.geolocation.watchPosition();
watch.subscribe((data) => {
this.geoInfo.data=JSON.stringify(data);
// data can be a set of coordinates, or an error (if an error occurred).
// data.coords.latitude
// data.coords.longitude
});
}
}
हालांकि, मैं अपने क्रोम के कंसोल में निम्न त्रुटि मिला
पहले मैंने सोचा था कि ऐसा इसलिए था क्योंकि मैं ब्राउज़र में डिबगिंग कर रहा था, लेकिन फिर मुझे अपने एंड्रॉइड फोन में एक ही त्रुटि मिली।
तो "भौगोलिक स्थान के लिए कोई प्रदाता" का अर्थ क्या नहीं है और मुझे अपने आयनिक 2 प्रोजेक्ट में भौगोलिक स्थान का उपयोग कैसे करना चाहिए?
बहुत बहुत धन्यवाद!
'app.module.ts' में जिओलोकेशन जोड़ने के बाद, मुझे एक नई त्रुटि मिली:' अनकही संदर्भ त्रुटि: जिओलोकेशन परिभाषित नहीं किया गया है '। – awmleer
वर्तनी के लिए जाँच करें Geolocationa – Sajeetharan
क्षमा करें, मैंने ऐसी मूर्खतापूर्ण गलती की है ... – awmleer