Ionic2: how to check a checkbox in a tooltip?

Using Ionic2 and angular2:

I want to show an alert box that has some text inside along with a checkbox - ask the user if they agree with the expression.

Please, help!!

+1


source to share


1 answer




//Prompt an alert, to ask user to verify there email address.
let alert = Alert.create({
  subTitle: 'Email not verified!',
  message:  'Please check your email for verification link.',
  inputs: [
    {
      name: 'getLink',
      label: 'Get verification link again ?',
      type: "checkbox",
      value: "true",
      checked: false
    }
  ],
  buttons: [
    {
      text: 'Ok',
      handler: data => {
        console.log(data);
        if(data.length > 0) {
          //console.log('Get me link');
          //we are calling this method to sent a link to user over mail - to verify their email address.
          user.sendEmailVerification(); 
          this.nav.rootNav.setRoot(HomePage);
          return true;
        } else {
          //console.log('Link not required!');
          this.nav.rootNav.setRoot(HomePage);
          return true;
        }
      }
    }
  ]
});
this.nav.present(alert);
      

Run codeHide result


+2


source







All Articles