I'm trying to get latitude and longtitute values from google maps provider and pass them to my ListPage but I couldn't do it with NavController.
imported navController:
import {NavController, NavParams} from 'ionic-angular';
imported ListPage:
import { ListPage } from '../pages/list/list';
constructor:
constructor(private navController: NavController, private navParams: NavParams)
code:
this.navController.push(ListPage, {
lat: lat1, lon: lon1
});
Everything looks fine but I get this
No Provider for NavController
error.
Is not possible to call NavController
from an @Injectable()
constructor.
1) Remove private navController: NavController
from constructor.
2) Add import { App } from 'ionic-angular';
and
constructor(public connectivityService: Connectivity, public app: App)
3) add this function
get navCtrl(): NavController {
return this.app.getActiveNav();
}
4)
this.navCtrl.push(ListPage, { lat: lat1, lon: lon1 });
5) At ListPage
constructor(public navParams: NavParams){
let lat = this.navParams.get('lat');
let lon = this.navParams.get('lon');
console.log(lat,lon);
}