Aurelia Ajax AutoComplete for jQuery -


iam trying use ajax autocomplete jquery in aurelia app. cant access object selected through autocomplete. js code.

this.questionpaperlookup = $('#question-paper-list').autocomplete({   lookup: this.questionpaperlookupdata,   minchars : 0,   onselect: function (suggestion) {     this.selectedquestionpaper = suggestion.data;   } }); 

here iam setting selectedquestionpaper based on selection autocomplete. , trying access object html this:

<span id = "selected-question-paper" class="auto_text selected_batches">             ${selectedquestionpaper.name}           </span> 

but name property of selectedquestionpaper object not displaying in view. dont know required step missing. in advance

you must use arrow functions have lexical this:

this.questionpaperlookup = $('#question-paper-list').autocomplete({   lookup: this.questionpaperlookupdata,   minchars : 0,   onselect: (suggestion) => {     this.selectedquestionpaper = suggestion.data;   } }); 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -