我正在使用ionic2来实现我的移动应用程序。
我在列表项中使用了ion-item-sliding来实现多种功能。
在我看来,我的每个项目都有html标签,如下所示:
...
<a ion-button href="tel:{{item.Phone}}">Office</a>
<a ion-button [href]="sanitize('sms:' + item.cellPhone)">Mobile</a>
<a ion-button href="tel:{{item.cellPhone}}">Text</a>
为了节省更多空间,我想将一些标签移动到ionic2 ActionSheet中,如下所示:
<button ion-button color="danger" (click)="presentActionSheet(item.altPhone)">
<ion-icon name="phone-portrait"></ion-icon>
Mobile
</button>
以下是我的组件类(ts文件)中的代码:
presentActionSheet(number) {
let actionSheet = this.actionSheetCtrl.create({
title: 'Do you want to?',
buttons: [
{
text: 'Make phone call',
role: 'destructive',
handler: () => {
this.call(number);
}
},{
text: 'Send message',
handler: () => {
//this.sendSMS(number);
window.open(this.sanitize('sms:'+number), '_blank');
return false;
}
},{
text: 'Cancel',
role: 'cancel',
handler: () => {
console.log('Cancel clicked');
}
}
]
});
actionSheet.present();
}
然而,当我点击发送消息(打开默认的短信应用程序)时,我得到了#34;加载错误&#34;在一个空白页面上。 我一直在尝试许多不同的方法将我的href标签移动到后端控制器。
有人可以帮忙吗?非常感谢你!
答案 0 :(得分:0)
只需更改窗口,打开:
window.location.href = "sms:" + number;
如果您还想附加短信使用:
window.location.href = "sms:" + number + "&body=Hello from George!";
享受!