Alright? I'm having difficulties, I hope you can help me ... I'm studying Ionic 2 very soon and thought of making a simple application. In JavaScript I did it quietly, but with Ionic does not work. It is the onChange () method that in ionic I believe is the ionChange (I researched), but I can not get it to work. I want that when selecting the "race" () "Humans" () the console will display a "Done Right" message. Very simple, but I can not.
HMTL:
<ion-list>
<ion-item>
<ion-label>Raças</ion-label>
<ion-select id="racas" [(ngModel)]="racas" (ionChange)="teste();">
<ion-option value="humanos">Humanos</ion-option>
<ion-option value="anoes">Anões</ion-option>
<ion-option value="elfos">Elfos</ion-option>
<ion-option value="gnomos">Gnomos</ion-option>
<ion-option value="meio-elfos">Meio-elfos</ion-option>
<ion-option value="meio-orcs">Meio-orcs</ion-option>
<ion-option value="halfling">Halfling</ion-option>
</ion-select>
</ion-item>
</ion-list>
TS:
export class HomePage {
public racas:string;
teste(racas:string) {
let x = (<HTMLInputElement>document.getElementById("racas")).value;
if (x == "humanos") {
console.log("Deu Certo!");
}
}
}