Error on Alert after upgrading to beta-3


#1

I upgraded my ionic version to beta 3 and on alert i am getting console error as “EXCEPTION: TypeError: Cannot read property ‘present’ of undefined”. My ts code works fine in beta 2. Is there any changes i have to implement in my code after this update? please help.

if (status == "success") {
            let alert = Alert.create({
                title: 'Success',
                message: 'I am added',
                buttons: ['OK']
            });
            this.nav.present(alert);
        } else {
            let alert = Alert.create({
                title: 'Error',
                message: 'Error on adding',
                buttons: ['OK']
            });
            this.nav.present(alert);
        }

#2

I think you need to post more of your code - it looks like its this.nav which is undefined and you can’t tell from the code you have pasted why this might be the case.


#3

Hi @richardshergold, you were absolutely right. By mistake i have deleted the NavController definition in the constructor. Thanks a lot again :slight_smile: