Unable to navigate to another page
Hi,
I am unable to navigate to another page. Below is my code. I want to go to another page with some parameters.
home.html
<button block outline (click)="navigate('NearClassSinglePage')">First Button</button>
home.ts
import { Component } from '@angular/core';
import {NavController} from 'ionic-angular';
import {NearClassSinglePage} from '../near-class-single/near-class-single';
@Component({
templateUrl: 'build/pages/home/home.html',
})
export class HomePage {
constructor(public navCtrl: NavController) {
this.classpage = NearClassSinglePage; /* This one is working */
}
/*But not this one, navigate function*/
navigate(page){
console.log(page);
}
}
First to navigate you need to use navCtrl to push() or setRoot() a page, you're just logging the page.
Hi @Lucillo
I will use this.navCtrl.push(); but navigate function is not working, i am not getting anything in console.log.
Hello @Aditya-app-dev ! Thanks for opening an issue with us. I would recommend that you check out our docs on using the NavController here. Also this part of the tutorial may be helpful. Since this is more of a support question and not an actual bug with the framework I am going to close this issue for now, but feel free to continue the conversation with @Luchillo if needed. Thanks for using Ionic!
Oh ok now i understand your problem, so the button shows up but nothing logs to the console when you click?
yes, you got point my point.
On Fri, Aug 26, 2016 at 12:26 AM, Carlos Esteban Lopez Jaramillo < [email protected]> wrote:
Oh ok now i understand your problem, so the button shows up but nothing logs to the console when you click?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/driftyco/ionic/issues/7872#issuecomment-242500012, or mute the thread https://github.com/notifications/unsubscribe-auth/AL8d-mqvsGrsDeHfmwMbC4VFpjH9clzTks5qjeVEgaJpZM4JtRzD .
Aditya Batra Web Application Developer Abacus Desk IT-Solutions Private Limited 5E/7, B.P, Railway Road, Near Neelam Chowk, NIT Faridabad - 121001,Haryana (INDIA) E-mail : [email protected] Web : www.abacusdesk.com
That's basic code, if it fails then it's most likely something wrong in some place we can't see, can you show your whole html/ts/scss (scss maybe it's a z-index problem, like something being on top blocking the click to reach the button itself).
Sure, Here is my code. Please find attachment and thanks for helping me.
On Fri, Aug 26, 2016 at 12:39 AM, Carlos Esteban Lopez Jaramillo < [email protected]> wrote:
That's basic code, if it fails then it's most likely something wrong in some place we can't see, can you show your whole html/ts/scss (scss maybe it's a z-index problem, like something being on top blocking the click to reach the button itself).
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/driftyco/ionic/issues/7872#issuecomment-242503681, or mute the thread https://github.com/notifications/unsubscribe-auth/AL8d-mK6gevdPYibFDI9RDJxfh0DJn24ks5qjeh9gaJpZM4JtRzD .
Aditya Batra Web Application Developer Abacus Desk IT-Solutions Private Limited 5E/7, B.P, Railway Road, Near Neelam Chowk, NIT Faridabad - 121001,Haryana (INDIA) E-mail : [email protected] Web : www.abacusdesk.com
Here where?
Reopening this one for now. Sorry @Aditya-app-dev i also misunderstood this issue. Thanks @Luchillo for taking another look at this. @Aditya-app-dev i would also love to see the rest of your code!
Great @jgw96, waiting for the code's link.
Hi,
Please download code from this link: https://www.dropbox.com/s/cs803g4ccokrzup/Application.zip?dl=0
On Fri, Aug 26, 2016 at 1:28 AM, Carlos Esteban Lopez Jaramillo < [email protected]> wrote:
Great @jgw96 https://github.com/jgw96, waiting for the code's link.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/driftyco/ionic/issues/7872#issuecomment-242516101, or mute the thread https://github.com/notifications/unsubscribe-auth/AL8d-hy3S5TwEy0McgLHrCtV8A7vevMqks5qjfPcgaJpZM4JtRzD .
Aditya Batra Web Application Developer Abacus Desk IT-Solutions Private Limited 5E/7, B.P, Railway Road, Near Neelam Chowk, NIT Faridabad - 121001,Haryana (INDIA) E-mail : [email protected] Web : www.abacusdesk.com
Hi,
I have solved the console thing, now i am getting value in console. But when i using this
navigate(page){
console.log(page);
this.navCtrl.push(page);
}
It's giving me error and this is not navigating to another page.

navigate(page){
console.log(page);
this.nav.push(NearClassSinglePage);
}
Above one is working but i need to send users by page id which will be dynamic. So i need this.nav.push(page);. Also in above code page is changing but back button is not working on NearClassSinglePage.
Ok i don't get what you're trying to do, first to push method you have to pass it an Angular Component, if that one needs parameters you can pass it as the second parameter of push method as stated in NavController/#push
Hello! Thanks for opening an issue with us! As this seems like more of a support question i will urge that you ask this question on our forum. Thanks for using Ionic!