使用Ionic2和Angular2,我想显示一个警告框,其中包含一个文本和复选框 - 询问用户是否同意该声明。
答案 0 :(得分:2)
//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);