2016-12-05 71 views
0

我是新来的离子框架,当我输入输入类型按钮时,它将进入页面的底部。我如何克服这些错误。 下面是我的代码:如何使用ionic2获取输入类型值?

<ion-header></ion-header> 
<ion-content padding> 
    <h2></h2> 
    <div> 
     <img class="displayed" style="height:100px; width:100px text-align: center;" src="assets/img/logo.png"> 
     <h2>Forgot Password</h2> 
    </div> 
    <p class="side" style= "margin-top:90px; color:grey; font-size:18px; font-family:'Arial', Helvetica, sans-serif">Enter the Phone number associated with your account, and we'll send an OTP to reset your password</p> 
<ion-item> 
    <ion-label stacked>PHONE</ion-label> 
    <ion-input type="number" value="" ></ion-input> 
<input type="number" placeholder="8121218820" ng-model="data.number" 
required> 
    </ion-item> 
    <button ion-button color="secondary" round>SEND OTP</button> 
</ion-content> 

下面是我的画面: enter image description here

+0

你是什么意思?是“当我输入输入类型按钮时,它将进入页面底部”这是你的问题吗?或者是“如何使用ionic2获取输入类型值?”这个问题?你说什么'错误'? – Ivaro18

回答

0

我真的上面,如果你使用的是

不明白你的问题,但

,但在你的代码

<ion-input type="number" value="" ></ion-input> 

那你为什么要再次使用input type =“number”placeholder =“8121218820”ng-model =“data.number” 要求>

那是什么一回事,除了如果你正在使用ionic2您还使用angular2结合

它不是NG-模型

<ion-input type="number" [(ngModel)]="data.number"></ion-input> 

还设置字段值默认值ionviewdidload函数或在构造函数中不在你的视图中