Cannot set property 'forwardViewId' of undefined


#1

I have a signin page then a side menu. After signing in the side menu works fine. But when i come back to signin page and then again try to go to the side menu i get the error ‘Cannot set property ‘forwardViewId’ of undefined’ with a blank screen with only a ion-nav-bar displayed.


Cannot set property ‘forwardViewId’ of undefined
#2

I too have encountered the same issue. My scenario is as follows:
Whenever you try to access a page and you’re not authenticated, the app redirects to the login screen. Once the user logs in, the app redirects to a default screen. The moment the user hits the login button the same “forwardViewId” error is shown.

I have found that this code is causing the problem:

It is rather curious to see that the counter x starts from 0 and yet it is being used as an array index with the value x - 1.


#3

Same problem here “‘Cannot set property ‘forwardViewId’ of undefined’” with almost the same flow.


#4

Same here, any solutions ?


Cannot set property ‘forwardViewId’ of undefined
#5

i’m having the same problem :frowning:


Cannot set property ‘forwardViewId’ of undefined
#6

I fixed my problem by surrounding the <ion-tabs> with <ion-view>. I’ve found the fix by comparing my code with the following codepen: http://codepen.io/ionic/pen/CbBsA.


#7

@mhartington Could you please take a look at this? They have told me over here That I could grab your attention here.
This is a big issue to me because it causes the application to fatally crash, and when you’re testing on an emulator not even closing and re-opening the app allows you to recover from this error.

Thanks in advance,
-Jose


#8

I have one spot that always throws this forward view id error.

    $injector.get('$ionicHistory').clearHistory();

is the best I could do to work around it. It’s always on a deauth call, so I don’t mind clearing the history.


#9

Would be better if the Ionic Team fixed it in the codebase though,

In my case I have this problem when I log out (which causes the flow to go to a sign-in state/view) and then immediately log-in again; which causes the flow to go to a home.dashboard state.

If I do this: “log-in/log-out, log-in/log-out” N number of times sequentially then eventually I’ll get the forwardViewId error. And I’m particularly concerned because when it happens there’s no way to recover the app, as in catch the exception and do something about it, needless to say it’s worse when you’re using the emulator or testing on a real device.

Hope they fix it soon,


#10

yeah that sounds like the same issue I have, is your sign-in state a top-level state as well? I’ve only seen this happen on transitions from/to nested to top-level states.

definitely an obnoxious bug and very difficult to debug on a real device, i agree. I haven’t really dug into it, but if code in emilianionascu’s post is accurate it should be an easy pull request, the problem is actually writing a failing spec for it.


#11

YES! My sign-in is a Top level state, and the home.dashboard state is of course nested.

Good to know There’s sort of a work-around, and I wish I could track it down and do it myself(a PR) but I don’t have the time to do it now. On the other hand it’s comforting to know I’m not the only one facing this issue, I hope we could hear what someone on the Ionic team thinks about it.

Hey, thanks for the reply man!


#12

cool, yeah my workaround is to clear $ionicHistory before going to the untabbed state.

Do you get this error only when calling $state.go('topLevelState') or does it throw with a ui-sref as well? I’ve only gotten it with $state.go in my controllers with some ng-click event.


#13

Hello there!

Yeah, that’s exactly my case as well, I’m pretty sure I’m not getting a ui-sref error.
But now that I think about it, I’m getting the error when I go from top-level state to tabbed state (not the other way around). And yes, it happens as a result of an ng-click event.

I will try the workaround that you’ve mentioned and see how it goes.
Thank you very much for your kind replies.
-J


#14

Any updates on this from anyone?

In our app it seems to also randomly throw on $ionicModal views. I still can’t replicate it consistently though :frowning:


#15

this was actually fixed in 1.0.0-rc.0, no longer an issue for us after upgrading