kadoshms / ionic2-autocomplete

Ionic 2 autocomplete component
MIT License
149 stars 108 forks source link

Need help using methods #100

Closed dealeo closed 6 years ago

dealeo commented 7 years ago

Hello,

I was able to use getSelection() and getValue() on click event but what I would like to do is get the selected element when I click on the list and not on the input area. Can you please help me to do that?

Another thing, I tried several things but I'm not able to use the method setFocus() on the component. Can you please assist me?

With best resgards,

Jerome

dealeo commented 7 years ago

Ok for first question, I found the solution using (itemSelected).

vasanth-qedquest commented 7 years ago

can you please post me the code for itemSelected event? I am unable to figure out.

dealeo commented 7 years ago

Hello,

Here is my html code : `<div id="writeAnswer" *ngIf="showWriteMode && !showComment"> <ion-searchbar (ionInput)="getItems($event)" placeholder="Indiquez votre réponse ..." autofocus [ngClass]="{ wrong: answerFalse == true, correct: answerTrue == true }">

{{ item.name }}

`

Here is my ts code : checkAnswer(answer){ this.userAnswer = answer; this.showViews(MODE_WRITE_RESULT); } `case MODE_WRITE_RESULT :

        if(this.userAnswer.toUpperCase() == this.question.correctAnswer.toUpperCase()){
        this.showWriteMode = true;
            this.showTryAgainButton = false;
        this.showChangeGameButtons = false;
        this.showButtonComment = true;
        this.answerTrue = true;
        this.showCommentPageWithDelay()
        } else {
        this.showWriteMode = true;
            this.showTryAgainButton = true;
        this.showChangeGameButtons = true;
        this.showButtonComment = false;
        this.OtherGame1 = "Une-Deux";
        this.OtherGame2 = "Big Four";
        this.answerFalse = true;
        }
    break;`