<ion-content padding>
<ion-list>
<ion-item>
<ion-label fixed>Username</ion-label>
<ion-input type="text" value="" (ngModel)]="userData.username"></ion-input> </ion-item>
<ion-item>
<ion-label fixed>Password</ion-label>
<ion-input type="password" (ngModel)]="userData.password"></ion-input>
</ion-item>
<button ion-button block color="primary" (click)="login()">Login</button>
</ion-list>
</ion-content>
当我访问y点击它正在抛出的按钮时,这是login.html代码 找不到未定义的属性名称
login()
{
this.authServiceProvider.postData(this.userData,'login').then((result) => {
this.responseData = result;
console.log(this.responseData);
localStorage.setItem('userData', JSON.stringify(this.responseData));
this.navCtrl.push(TabsPage);
},
(err) =>
{
// Error log
});
}
答案 0 :(得分:0)
您在所有ngModel
中缺少[
<ion-input type="text" value="" [(ngModel)]="userData.username"></ion-input> </ion-item>