ionic 获取input的值
生活随笔
收集整理的這篇文章主要介紹了
ionic 获取input的值
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1.ngModel? 雙向綁定
.html
<ion-input type="number" placeholder="輸入X坐標" [(ngModel)]="x"></ion-input> <ion-input type="number" placeholder="輸入Y坐標" [(ngModel)]="y"></ion-input> <button (click)="pointLocation()">定位</button>.ts
x: number;y: number;popintLocation() {console.log(this.x);console.log(this.y);}2.參數傳遞法
.html
<ion-input type="text" placeholder="請輸入賬號" #username></ion-input> <ion-input type="password" placeholder="請輸入密碼" #password></ion-input> <button (click)="login(username, password)">登錄</button>.ts
login(username: HTMLInputElement, password: HTMLInputElement) {console.log(username.value)console.log(password.value)}?
總結
以上是生活随笔為你收集整理的ionic 获取input的值的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: dojo发布者订阅者模式(topic.p
- 下一篇: SVN 中更新与资源库同步的区别