2
onclickプロパティのdoLogout関数を定義したボタンがありますが、そのボタンをクリックするたびに次のエラーが表示されます:ionic 3 - ランタイムエラー関数が定義されていない - ReferenceError:HTMLButtonElement.onclickで関数が定義されていない
Runtime Error function not defined - ReferenceError: function is not defined at HTMLButtonElement.onclick
コードは非常に単純で、関数が正しく呼び出される他のページで使用しました。これは私のHTMLファイルです:
<ion-header>
<ion-navbar>
<ion-title>Logout</ion-title>
</ion-navbar>
</ion-header>
<ion-content>
<div padding>
<button ion-button block onclick="doLogout()">Logout</button>
</div>
</ion-content>
そして、これはTSファイルです:
export class LogoutPage {
constructor(public navCtrl: NavController, public navParams: NavParams,
public api : Api) {
}
doLogout(){
//does something
}
}