Validation with Ionic storage field


#1

Hello everybody,

i am new to ionic and doing a little project for my studies. I develop a scavenger hunt app and want a validation for my team-name input field. It should be control if the teamname includes swearwords etc.

I saw a lot of tutorials about custom validators but my problem is i have no idea how too do a validation with ionic storage field. (i save the teamname from the input field in ionic storage cuz in the end there is a ranking with all teams and scores)

Do anyone has a tutorial or a example how to achive this?

For example her is my ionic storage team side.

team.html:

<ion-input placeholder = “Eingabe Namen” type=“text” max=10 [(ngModel)]=“Startup.teamname” > name=‘teamname’>

team.ts:

Startup = { teamname: ’ ’ };

openOrtPage() {
this.storage.set(“myTeam”, this.Startup.teamname);
console.log(this.Startup.teamname);
this.presentToast();
setTimeout(() => {
this.navCtrl.push(FragenPage);
}, 1000);
}

Thanks a lot for your help! This framework is awesome :slight_smile:

Greets
Sabl


#2

Use navParams and read doc on navcontroller on how to pass data to other pages. Not storage.

If that is the underlying need

For the rest the storage doc on ionic is very clear with examples

Usage of setTimeout in this stage of learning is generally a good indicator of necessity to learn about async and promises