Skip to content

Conversation

@VictorGarcia
Copy link

With the current implementation it is not possible to access this.$element
from the itemSelected function. This comes handy when implementing
several typeaheads in the same page and you need to react in other elements
once the typeahead was selected. By using proxy we are passing the current
element in the context and it can be accessed as 'this' from within 
itemSelected. 

Example:
[...]
itemSelected: function (item) {
    $(this).prev('input[type="hidden"]').val(item);
},
[...]

With the current implementation it is not possible to access this.$element
from the itemSelected function. This comes handy when implementing
several typeaheads in the same page and you need to react in other elements
once the typeahead was selected. By using proxy we are passing the current
element in the context and it can be accessed as 'this' from within 
itemSelected. 

Example:
[...]
itemSelected: function (item) {
    $(this).prev('input[type="hidden"]').val(item);
},
[...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant