I am creating a login with ionic 2. Please don't just answer "you just need to add the [(ngModules)]-attribute". If you think, this is the solution, please explain it why. Explain it, like you would do it to a child.
My Code in login.ts:
import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams, MenuController} from 'ionic-angular';
@IonicPage()
@Component({
selector: 'page-login',
templateUrl: 'login.html',
})
export class LoginPage {
password: string;
constructor(public navCtrl: NavController, public navParams: NavParams, public menu: MenuController) {
this.menu.enable(false, "");
}
login() {
alert(this.password);
}
ionViewDidLoad() {
console.log('ionViewDidLoad LoginPage');
}
}
The Code in login.html
<ion-content padding id="login-dialog">
<ion-list inset>
<ion-item no-padding>
<ion-label color="primary">
<ion-icon name="person"></ion-icon>
</ion-label>
<ion-input type="text" placeholder="Username"></ion-input>
</ion-item>
<ion-item no-padding>
<ion-label color="primary">
<ion-icon name="lock"></ion-icon>
</ion-label>
<ion-input type="password" placeholder="Password"></ion-input>
</ion-item>
<button ion-button full color="primary" (click)="login()">Login</button>
</ion-list>
</ion-content>