How can I make ionic input to appear when choosing options from the ion-select without using OK button?











up vote
0
down vote

favorite












I am using ion-select to let the user to select the options, and inside ion-option there contains a list of options from which the user chooses one. If the user chooses "Others" option, an input appears automatically, so that the user types the option that is not available in the drop down. Now I need to use the ion-select without OK and CANCEL buttons.Since I have already implemented, I need to show the ion-input field to appear automatically when the user chooses the "Others" option. This logic is working correctly, if I am using with OK & CANCEL button. Now I need to implement the same logic without OK & CANCEL buttons. The ion-input appears only if the user chooses the "Others" options and clicking on "OK" button. Since I don't want to use any buttons here, I want the "Others" ion-input field to appear directly as soon as the user chooses the "Others" option in the drop-down without pressing the OK button. Please help me out.



Here's what I have tried so far:



in my HTML:



<ion-select class="mydate" formControlName="bankselect" [(ngModel)]="vm.bankselect" interface="popover" (ionChange) = "bankChange($event)"  class="textcolor" value="bank">
<ion-option *ngFor="let item of banklist; let i =index" value="{{i}}">{{item.value}}</ion-option>
</ion-select>

<ion-item no-lines *ngIf = "vm.bankselect == 6">
<ion-icon class="iconstyle" name="logo-bitcoin" item-start></ion-icon>
<ion-label floating color="primary">Others</ion-label>
<ion-input type="text" (ionChange)="notify($event)" class="textcolor" formControlName = "Others" [(ngModel)]="vm.Others" maxlength="50" tabindex="1" (keyup)="moveFocus($event,query, false)"></ion-input>
</ion-item>









share|improve this question


























    up vote
    0
    down vote

    favorite












    I am using ion-select to let the user to select the options, and inside ion-option there contains a list of options from which the user chooses one. If the user chooses "Others" option, an input appears automatically, so that the user types the option that is not available in the drop down. Now I need to use the ion-select without OK and CANCEL buttons.Since I have already implemented, I need to show the ion-input field to appear automatically when the user chooses the "Others" option. This logic is working correctly, if I am using with OK & CANCEL button. Now I need to implement the same logic without OK & CANCEL buttons. The ion-input appears only if the user chooses the "Others" options and clicking on "OK" button. Since I don't want to use any buttons here, I want the "Others" ion-input field to appear directly as soon as the user chooses the "Others" option in the drop-down without pressing the OK button. Please help me out.



    Here's what I have tried so far:



    in my HTML:



    <ion-select class="mydate" formControlName="bankselect" [(ngModel)]="vm.bankselect" interface="popover" (ionChange) = "bankChange($event)"  class="textcolor" value="bank">
    <ion-option *ngFor="let item of banklist; let i =index" value="{{i}}">{{item.value}}</ion-option>
    </ion-select>

    <ion-item no-lines *ngIf = "vm.bankselect == 6">
    <ion-icon class="iconstyle" name="logo-bitcoin" item-start></ion-icon>
    <ion-label floating color="primary">Others</ion-label>
    <ion-input type="text" (ionChange)="notify($event)" class="textcolor" formControlName = "Others" [(ngModel)]="vm.Others" maxlength="50" tabindex="1" (keyup)="moveFocus($event,query, false)"></ion-input>
    </ion-item>









    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I am using ion-select to let the user to select the options, and inside ion-option there contains a list of options from which the user chooses one. If the user chooses "Others" option, an input appears automatically, so that the user types the option that is not available in the drop down. Now I need to use the ion-select without OK and CANCEL buttons.Since I have already implemented, I need to show the ion-input field to appear automatically when the user chooses the "Others" option. This logic is working correctly, if I am using with OK & CANCEL button. Now I need to implement the same logic without OK & CANCEL buttons. The ion-input appears only if the user chooses the "Others" options and clicking on "OK" button. Since I don't want to use any buttons here, I want the "Others" ion-input field to appear directly as soon as the user chooses the "Others" option in the drop-down without pressing the OK button. Please help me out.



      Here's what I have tried so far:



      in my HTML:



      <ion-select class="mydate" formControlName="bankselect" [(ngModel)]="vm.bankselect" interface="popover" (ionChange) = "bankChange($event)"  class="textcolor" value="bank">
      <ion-option *ngFor="let item of banklist; let i =index" value="{{i}}">{{item.value}}</ion-option>
      </ion-select>

      <ion-item no-lines *ngIf = "vm.bankselect == 6">
      <ion-icon class="iconstyle" name="logo-bitcoin" item-start></ion-icon>
      <ion-label floating color="primary">Others</ion-label>
      <ion-input type="text" (ionChange)="notify($event)" class="textcolor" formControlName = "Others" [(ngModel)]="vm.Others" maxlength="50" tabindex="1" (keyup)="moveFocus($event,query, false)"></ion-input>
      </ion-item>









      share|improve this question













      I am using ion-select to let the user to select the options, and inside ion-option there contains a list of options from which the user chooses one. If the user chooses "Others" option, an input appears automatically, so that the user types the option that is not available in the drop down. Now I need to use the ion-select without OK and CANCEL buttons.Since I have already implemented, I need to show the ion-input field to appear automatically when the user chooses the "Others" option. This logic is working correctly, if I am using with OK & CANCEL button. Now I need to implement the same logic without OK & CANCEL buttons. The ion-input appears only if the user chooses the "Others" options and clicking on "OK" button. Since I don't want to use any buttons here, I want the "Others" ion-input field to appear directly as soon as the user chooses the "Others" option in the drop-down without pressing the OK button. Please help me out.



      Here's what I have tried so far:



      in my HTML:



      <ion-select class="mydate" formControlName="bankselect" [(ngModel)]="vm.bankselect" interface="popover" (ionChange) = "bankChange($event)"  class="textcolor" value="bank">
      <ion-option *ngFor="let item of banklist; let i =index" value="{{i}}">{{item.value}}</ion-option>
      </ion-select>

      <ion-item no-lines *ngIf = "vm.bankselect == 6">
      <ion-icon class="iconstyle" name="logo-bitcoin" item-start></ion-icon>
      <ion-label floating color="primary">Others</ion-label>
      <ion-input type="text" (ionChange)="notify($event)" class="textcolor" formControlName = "Others" [(ngModel)]="vm.Others" maxlength="50" tabindex="1" (keyup)="moveFocus($event,query, false)"></ion-input>
      </ion-item>






      android angular mobile ionic3 hybrid-mobile-app






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 21 hours ago









      Thedroider

      175




      175
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          I'm not sure but maybe you should try (ionSelect).



          in your .html file should be like this.



             <ion-select "some codes...">
          <ion-option *ngFor="...." "some codes..." (ionSelect)="showInput(item.value)"></ion-option>
          </ion-select>

          <ion-item no-lines *ngIf = "show">
          <ion-icon class="iconstyle" name="logo-bitcoin" item-start></ion-icon>
          <ion-label floating color="primary">Others</ion-label>
          <ion-input type="text" (ionChange)="notify($event)" class="textcolor" formControlName = "Others" [(ngModel)]="vm.Others" maxlength="50" tabindex="1" (keyup)="moveFocus($event,query, false)"></ion-input>
          </ion-item>


          and .ts file



          show: boolean = false;

          showInput(item){
          if(item == 'other'){
          this.show = true;
          }
          else
          this.show = false;
          }





          share|improve this answer





















          • .., thanks it's worked!!!
            –  Thedroider
            18 hours ago











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53237803%2fhow-can-i-make-ionic-input-to-appear-when-choosing-options-from-the-ion-select-w%23new-answer', 'question_page');
          }
          );

          Post as a guest
































          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          2
          down vote



          accepted










          I'm not sure but maybe you should try (ionSelect).



          in your .html file should be like this.



             <ion-select "some codes...">
          <ion-option *ngFor="...." "some codes..." (ionSelect)="showInput(item.value)"></ion-option>
          </ion-select>

          <ion-item no-lines *ngIf = "show">
          <ion-icon class="iconstyle" name="logo-bitcoin" item-start></ion-icon>
          <ion-label floating color="primary">Others</ion-label>
          <ion-input type="text" (ionChange)="notify($event)" class="textcolor" formControlName = "Others" [(ngModel)]="vm.Others" maxlength="50" tabindex="1" (keyup)="moveFocus($event,query, false)"></ion-input>
          </ion-item>


          and .ts file



          show: boolean = false;

          showInput(item){
          if(item == 'other'){
          this.show = true;
          }
          else
          this.show = false;
          }





          share|improve this answer





















          • .., thanks it's worked!!!
            –  Thedroider
            18 hours ago















          up vote
          2
          down vote



          accepted










          I'm not sure but maybe you should try (ionSelect).



          in your .html file should be like this.



             <ion-select "some codes...">
          <ion-option *ngFor="...." "some codes..." (ionSelect)="showInput(item.value)"></ion-option>
          </ion-select>

          <ion-item no-lines *ngIf = "show">
          <ion-icon class="iconstyle" name="logo-bitcoin" item-start></ion-icon>
          <ion-label floating color="primary">Others</ion-label>
          <ion-input type="text" (ionChange)="notify($event)" class="textcolor" formControlName = "Others" [(ngModel)]="vm.Others" maxlength="50" tabindex="1" (keyup)="moveFocus($event,query, false)"></ion-input>
          </ion-item>


          and .ts file



          show: boolean = false;

          showInput(item){
          if(item == 'other'){
          this.show = true;
          }
          else
          this.show = false;
          }





          share|improve this answer





















          • .., thanks it's worked!!!
            –  Thedroider
            18 hours ago













          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          I'm not sure but maybe you should try (ionSelect).



          in your .html file should be like this.



             <ion-select "some codes...">
          <ion-option *ngFor="...." "some codes..." (ionSelect)="showInput(item.value)"></ion-option>
          </ion-select>

          <ion-item no-lines *ngIf = "show">
          <ion-icon class="iconstyle" name="logo-bitcoin" item-start></ion-icon>
          <ion-label floating color="primary">Others</ion-label>
          <ion-input type="text" (ionChange)="notify($event)" class="textcolor" formControlName = "Others" [(ngModel)]="vm.Others" maxlength="50" tabindex="1" (keyup)="moveFocus($event,query, false)"></ion-input>
          </ion-item>


          and .ts file



          show: boolean = false;

          showInput(item){
          if(item == 'other'){
          this.show = true;
          }
          else
          this.show = false;
          }





          share|improve this answer












          I'm not sure but maybe you should try (ionSelect).



          in your .html file should be like this.



             <ion-select "some codes...">
          <ion-option *ngFor="...." "some codes..." (ionSelect)="showInput(item.value)"></ion-option>
          </ion-select>

          <ion-item no-lines *ngIf = "show">
          <ion-icon class="iconstyle" name="logo-bitcoin" item-start></ion-icon>
          <ion-label floating color="primary">Others</ion-label>
          <ion-input type="text" (ionChange)="notify($event)" class="textcolor" formControlName = "Others" [(ngModel)]="vm.Others" maxlength="50" tabindex="1" (keyup)="moveFocus($event,query, false)"></ion-input>
          </ion-item>


          and .ts file



          show: boolean = false;

          showInput(item){
          if(item == 'other'){
          this.show = true;
          }
          else
          this.show = false;
          }






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 19 hours ago









          Eray

          475




          475












          • .., thanks it's worked!!!
            –  Thedroider
            18 hours ago


















          • .., thanks it's worked!!!
            –  Thedroider
            18 hours ago
















          .., thanks it's worked!!!
          –  Thedroider
          18 hours ago




          .., thanks it's worked!!!
          –  Thedroider
          18 hours ago


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53237803%2fhow-can-i-make-ionic-input-to-appear-when-choosing-options-from-the-ion-select-w%23new-answer', 'question_page');
          }
          );

          Post as a guest




















































































          Popular posts from this blog

          Bressuire

          Vorschmack

          Quarantine