Ionic version: (check one with "x")
[ ] 1.x
[x] 2.x
I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
Current behavior:
Pushing view through navController is bugging on a button inside a view.
Expected behavior:
New view should be pushed
Steps to reproduce:
Create a button on a page and set the (click) method to a method in typescript, and push a new view.
Related code:
html:
<button ion-button (click)="login()" full>Login</button>
TS:
login() {
this.navCtrl.push(LoginPage);
}
Error message:
null is not an object (evaluating 'leavingNavbarEle.querySelector')
Other information:
Only on iOS, android works fine
Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.13
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.45
ios-deploy version: 1.9.0
ios-sim version: 5.0.8
OS: macOS Sierra
Node Version: v6.9.1
Xcode version: Xcode 8.1 Build version 8B62
Thanks for the issue! Unfortunately I'm not able to reproduce this. Could you provide some more information about your app, maybe a plunker or repository that we can download to reproduce this? For example, the conference app pushes a page from the tutorial page:
https://github.com/driftyco/ionic-conference-app/blob/master/src/pages/tutorial/tutorial.html#L19-L22
https://github.com/driftyco/ionic-conference-app/blob/master/src/pages/tutorial/tutorial.ts#L44
@heldertb can you provide a repo the reproduces the issue?
@manucorporat I'll try, but the problem is this perfectly works on all my other pages. But this one is bugging.
EDIT: I made a new project trying to reproduce it, but I can't it seems.
Very weird. Will debug more and find out what's causing this
@heldertb are you using *ngIf in ion-navbar?
@manucorporat Yes I am! is this why?
@heldertb nice! I know exactly what is going on, and it will be fixed.
But in the meantime, could you just use: [hidden] instead of *ngIf?
@manucorporat I don't think so. I use *ngIf to check if a user is logged in. and if he is, show some buttons on the page.
Any idea on how I could use it then?
@heldertb I don't get it, why you can't use:
<ion-navbar [hidden]="logged()">
instead of:
<ion-navbar *ngIf="logged()">
?
visually it is the same
@manucorporat Hah. thanx, couldn't find any docs on it from a basic search, all i needed! thanx!
EDIT: works like a charm
Great work!
@helderdb, Thanks for filing the bug and @manucorporat for providing a workaround.
Why did you close this ticket? Did this bug get solved for you in a release?
I am still running into this or a very similar problem using 3.4.2. The workaround works for me too but as far as I can tell, it is still an issue.
@manucorporat Thank you so much, i had the same problem and it was solved perfectly by your "hidden" suggestion. By the way, I'm using ionic 3.7.0
Still an issue in version 3.19.1. The workaround from @manucorporat still fixes the problem.
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Most helpful comment
@heldertb nice! I know exactly what is going on, and it will be fixed.
But in the meantime, could you just use:
[hidden]instead of*ngIf?