Ionic 2 rc0: cannot read property ... of undefined

Hi,

I’m currently upgrading from latest beta to rc0. However, I have one big problem: In general it seems to work well now. But often when i switch views, I get different “Cannot read property ‘…’ of undefined” errors, thrown by the views. However, I do not get these on the beta version and it also does not always happen. Especially it seems to happen when I’m doing some asynchronous task (e.g. loading data) and switching views before data arrived. But it seems there are also other cases without async loading.

Most issues are, when a view tries to access “someObj.someField”. It complains that “someObj” is undefined. Sometimes it happens even in controller with “this.someObj”. Not sure about the last one due to missing debug functionality, but it seems like “this” is undefined in that context? Seems like often it happens with custom components when there is an @Input() member. That members sometimes seem to be undefined in this case…

Since I cannot really debug RC0 due to https://github.com/driftyco/ionic/issues/8292 I am a bit clueless what I should do now. Maybe somebody else hit similar problems and knows how to solve it?

Side note:
I really like what you have been doing with Ionic 2. Upgrading from Ionic 1 required a lot of rewriting the application, but it was much faster then developing Ionic 1 application and much more flawless. However, this upgrade to RC0 could have been done better, I think. Especially migration tasks could have been more detailed, and the “upgrade by new project” seems incomplete to me. Had to follow some of the steps from migration an old project by upgrading it and also had to go through changelist of release notes to find all relevant things… I see that these changes where necessary, but next time maybe you could help us with better description and maybe even a migration script which does things automatically.

Greetings

1 Like