Function in Ionic 3

0

I'm trying to get a function from the TS file of the page just like that, I would need to capture the html information to do a push conditional (navCtrl) for each option ... can someone help me ? The list in which I need to get the info has this code: <ion-list> <ion-item> <ion-label>Ocupação</ion-label> <ion-select [(ngModel)]="ocupacao"> <ion-option value="dir" >Diretor(a)</ion-option> <ion-option value="prof">Professor(a)</ion-option> <ion-option value="res">Responsável</ion-option> <ion-option value="sec">Secretária</ion-option> </ion-select> </ion-item> </ion-list>

    
asked by anonymous 20.07.2018 / 16:22

1 answer

0

With the two-way data binding you can access the variable in .ts as this.ocupacao, so let's say that when calling a submit the onSubmit function below is executed

onSubmit = () =>{
  //acessando à variável ocupacao
  console.log(this.ocupacao);
  if(this.ocupacao == 'dir')
     this.navCtrl.push(DirPage);
}
    
23.07.2018 / 20:45