gpt4 book ai didi

ionic2 - ionic 2 电话号码不起作用

转载 作者:行者123 更新时间:2023-12-04 11:48:35 24 4
gpt4 key购买 nike

我不想写应用程序可以通过用户输入的号码调用。

但我使用 http://ionicframework.com/docs/v2/native/callnumber/它不工作。

这是我的代码 ts

import { Component } from '@angular/core';
import {CallNumber} from 'ionic-native';
import { Platform, ActionSheetController } from 'ionic-angular';
// import { NavController } from 'ionic-angular';
declare var window;
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor(
public platform: Platform,
public actionsheetCtrl: ActionSheetController
) { }
strShowInHtml = "";
callIT(){
// window.location = '12345';
CallNumber.callNumber("12345", true)
.then(() =>{
console.log('Launched dialer!');
this.strShowInHtml="ok";
})
.catch(() => {
console.log('Error launching dialer');
this.strShowInHtml="error";
});
}
}

和我的代码 html:
<ion-header>
<ion-navbar>
<ion-title>Action Sheets</ion-title>
</ion-navbar>
</ion-header>

<ion-content padding class="action-sheets-basic-page">
<button md-button (click)="callIT()">callIT</button>
</ion-content>

我知道我可以使用
<a ion-button href="tel:+0839504890">Call me 1 </a>

但我不想使用它,因为它会去查看调用电话。
我想单击按钮,我的应用程序 Ionic 2 将调用用户输入的号码。

最佳答案

在你的组件类中,请写如下

callIT(mobNumber:string)      
{
window.open("tel:" + mobNumber);
}

关于ionic2 - ionic 2 电话号码不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40543763/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com