Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70439

Replace ion-select option text from previous text to new text

$
0
0

@FK2193 wrote:

i want to change the text of ion-select option from the previous one to a new one when I enter a text though alert controller.
here is my code
html file

 <ion-select  (ionChange)="ForNewRoutine(newr)" [(ngModel)]="Routine">

      <ion-option value="Breakfast">Breakfast</ion-option>
      <ion-option value="Lunch">Lunch</ion-option>
      <ion-option value="Dinner">Dinner</ion-option>
      <ion-option (ion-Select)="newroutine" value="new">Create a new one</ion-option>
    </ion-select>

ts file

ForNewRoutine(newr) {
    if (this.Routine=='new') {
      let routine = this.altertCtrl.create({
        title: "Enter your Routine",
        inputs: [
          {
            type: "text",
            name: "routine",
          }]
        ,
        buttons: [{
          text: "Cancel"
        }, {
          text: "Add Routine",

          handler: (inputData) => {
            let addtext;
            addtext = inputData.routine;

            this.Routine[addtext];

            ///this.Routine.push(addtext);/* for pop up adding message*/
            routine.onDidDismiss(() => {
              let routineToast = this.toastCtrl.create({
                message: "new user is added successfully",
                duration: 2000
              });
              routineToast.present();

            });


          }

        }]
      });
      routine.present();

    } else {
    console.log('value not replace');
    }
}

timesss
bedd
time in last image they didint show new routine , i want show that new routine in that last image when i entered it .

Thank you.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70439

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>