如何在Ionic2的警报提示中放入复选框输入? [英] How to put a checkbox input inside an alert prompt in Ionic2?
本文介绍了如何在Ionic2的警报提示中放入复选框输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用Ionic2和Angular2,显示一个警报框,其中带有文本和复选框-询问用户他/她是否同意该声明.
Using Ionic2 and Angular2, I want to show an alert box, inside which a text along with checkbox - to ask for user if he/she agree to the statement.
推荐答案
//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);
这篇关于如何在Ionic2的警报提示中放入复选框输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文