virtual keyboard with autocomplete in form

时间:2016-04-25 08:58:39

标签: javascript jquery angularjs keyboard virtual-keyboard

using AngularJS.

I want to add a virtual keyboard to my form. Therefore I tried using keyboard. In the setup they explain to use an input field or a textarea. However, as I am using autocomplete with <md-autocomplete> from angular-material, i do not have an input field. So i tried binding the opening event of the keyboard to this tag. The opening work, however when trying to type, the following error occurs:

Uncaught TypeError: k.createTextRange is not a function

The same error occurs when putting the id in the form field.

I also tried, putting a hidden input field behind my autocomplete tag and copying the value of input after finishing typing. However, the thing here is, that i kind of lose the autocomplete-feature, when just copying the input after finishing typing (Autocomplete should work while typing as well).

So right now my code is this, when trying to use the form tag with the keyboard id:

<form ng-submit="mmsiSearch()" id="keyboard" ng-click="showKeyboard()" layout="row" layout-align="center">
                    <md-autocomplete
                        required = ""
                        md-autofocus="true"
                        md-input-name="autocompleteField"
                        md-input-minlength="2"
                        md-input-maxlength="20"
                        md-no-cache="noCache"
                        md-search-text="shipSearchValue"
                        md-items="item in search(shipSearchValue)"
                        md-item-text="item"
                        flex="80">
                      <md-item-template>
                        <span md-highlight-text="shipSearchValue">{{ item }}</span>
                      </md-item-template>
                      <md-not-found>
                        No matches found.
                      </md-not-found>
                    </md-autocomplete>
                    <md-button type="submit" flex="20">
                      Search
                    </md-button>
                  </form>

So my question is now, does anyone know how to use a virtual keyboard with the md-autocomplete option. If have tried some other libraries, however the keyboard should not be a directive, as then the multiple directive error occurs. I am open to any other library, if its working. Thanks!

0 个答案:

没有答案