Native Storage Error, does not show the following screen - IONIC 3

4

I'm trying to implement a login, which has 2 registration options, one with your data that is in FB, and the other put them manually.

In the first form, the user uses his / her facebook account, to obtain the corresponding data of this username and mail, then this is addressed to the next view or interface, where he must place a telephone number, to then place the data in input's or text boxes.

In the second registration option, the user uses the option Register Now , where the user is taken to the previously mentioned page, but in this case, the input's are empty.

My error arises when I give it in the second option, and I get the following error and it does not show the screen:

It tells me that it is empty Then my question is the following as I make it when it arrives empty show the normal screen

Maybe this is an error in this class:

ionViewCanEnter() {
        console.log('Ya llegue');
        let env = this;
        return this.nativeStorage.getItem('user')
            .then(function (data) {
                env.user = {
                    name: data.name,
                    email: data.email
                };
                console.log(env.user);
                env.userReady = true;
                return true;
            }, function (error) {
                console.log(error);
                return false;
            });
    }
  

And this is my html of my home page where the 2 buttons arrive:

<ion-content padding class="body" align="center">
    <img src="assets/logito.png">
    <br>
    <br>

    <ion-list *ngIf="userReady">
        <ion-item>
            <ion-label>
                <ion-icon name="person"></ion-icon>
            </ion-label>
            <ion-input type="text" placeholder="Nombres" [(ngModel)]="user.name">
            </ion-input>
        </ion-item>
        <ion-item>
            <ion-label>
                <ion-icon name="mail"></ion-icon>
            </ion-label>
            <ion-input type="text" placeholder="Nombres" [(ngModel)]="user.email">
            </ion-input>
        </ion-item>
        <ion-item>
            <ion-label>
                <ion-icon name="call"></ion-icon>
            </ion-label>
            <ion-input clearInput type="number" placeholder="Teléfono">
            </ion-input>
        </ion-item>
    </ion-list>
    <button ion-button item-end round full icon-start color="dark" class="botones">
        <ion-icon name='checkmark-circle-outline'></ion-icon>
        registar
      </button>
</ion-content>

    
asked by Ivan More Flores 10.08.2017 в 18:09
source

1 answer

2

I was seeing the .gif and I think what you are doing in redirecting to the same place with different parameters, as if you wanted to access a method once with the parameters you expect and another without parameters, which would not be correct.

In the facebook plugin when you complete the form, send the information you filled and then come to the console.log ("I'm here") with the values you entered.

According to the documentation you are getting a code 2 which means that you can not find the item in this case 'user'. Documentation codes: error-codes

In the register now you must validate that if something comes, if you do not send the empty values to the other window or redirect to a different window.

    
answered by 23.08.2017 в 23:31