Home > other >  How to get String from input box in Ionic? I'm using Ionic framework for making application
How to get String from input box in Ionic? I'm using Ionic framework for making application

Time:09-17

I'm trying to get value from my alert in Ionic framework application. I made application and when i click the button, alert(prompt) which i can input string appears. Even i type string in the input box and press 'ok' button , i can't do anything. I wanna get each input box's string data. What should i do? Base language is Javscript. (angularjs, javascript, .ts file ) I'm trying to put WIFI information in input box and want to handle it. For example, if i type "test" and press 'ok', I wanna save it in variable. Help pls. Tnx

enter image description here

CodePudding user response:

You can handle the data like this example:

const alert = await this.alertController.create({
    inputs: [
    {
        name: 'name',
        type: 'text'
    }],    
    buttons: [
        {
            text: 'Ok',
            handler: (data) => {
                console.log(data);
            }
        }
    ]
});
await alert.present();

You can check this old version from here.

  • Related