Currently, I am utilizing Angular2 with Ionic2 for my mobile app development. Everything was working flawlessly until I decided to incorporate a new module for Google Maps navigation. Specifically, I am using phonegap-launch-navigator for this purpose. The class responsible for importing these modules is the Maps class, and its structure is as follows:
import { LaunchNavigator, LaunchNavigatorOptions} from 'ionic-native';
import { Component, NgZone } from "@angular/core";
import { NavController, Platform, NavParams } from 'ionic-angular';
import {GoogleMap, GoogleMapsEvent, GoogleMapsLatLng, GoogleMapsMarkerOptions, CameraPosition } from 'ionic-native';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/map';
import { Geolocation } from 'ionic-native';
import { Injectable,forwardRef,Inject } from "@angular/core";
@Component({
selector: 'maps-page',
templateUrl: 'maps.html',
})
export class MapsPage {
private map: GoogleMap;
destination:string;
start:string;
constructor(public LaunchNavigatorOptions: LaunchNavigatorOptions,
private _navController: NavController,
private LaunchNavigator:LaunchNavigator,
private platform: Platform,
public navCtrl: NavController,
public navParams: NavParams,
private _zone: NgZone) {
this.start = "";
this.destination = "Westminster, London, UK";
this.platform.ready().then(() => this.onPlatformReady());
}
Moreover, my package.json is structured like this:
{
"name": "ionic-hello-world",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve",
"test": "mocha"
},
// Dependencies and devDependencies go here...
}
Now, after adding these two modules and inserting them in the constructor, my application fails to initialize properly. It throws a runtime error stating "Can't resolve all parameters for MapsPage(?,NavController,LaunchNavigator,Platform,NavController,NavParams,NgZone). It seems that the issue lies with LaunchNavigatorOptions because when I comment it specifically, the app runs smoothly again. Is there any solution or workaround that can help me make it function without errors? Any assistance would be greatly appreciated. Thank you!