2
about.html這裏是html頁面ionic2電話功能顯示錯誤:意外令牌。構造函數,方法,訪問,或財產預計
<ion-content>
<ion-fab center buttom>
<button ion-fab color="light">
<ion-icon name='call'></ion-icon>
</button>
</ion-fab>
<!-- <a ion-button color="light" href="tel:1800889958">
立即撥打
</a> -->
</ion-content>
about.ts
這裏是打字稿頁。我安裝電話號碼插件ald,並導入到app.module.ts中。
誤差示出在 '這個'
錯誤消息:意外的標記。期望構造函數,方法,訪問器或屬性。
import { Component } from '@angular/core';
import { CallNumber } from '@ionic-native/call-number';
@Component({
selector: 'page-about',
templateUrl: 'about.html'
})
export class AboutPage {
constructor(private call: CallNumber) { }
this.callNumber.callNumber("1800889958", true)
.then(() => console.log('Launched dialer!'))
.catch(() => console.log('Error launching dialer'));
}
CLI錯誤顯示:
[09:56:04] typescript: src/pages/about/about.ts, line: 14
Unexpected token. A constructor, method, accessor, or property was expected.
L14: this.callNumber.callNumber("1800889958", true)
L15: .then(() => console.log('Launched dialer!'))
[09:56:04] typescript: src/pages/about/about.ts, line: 18
Declaration or statement expected.
我在app.module.ts ald中添加CallNumber ...但仍顯示此錯誤 –
已更新,我希望它可以解決您的問題。 –
當我嘗試仍然有同樣的問題 –