I want to use Typeahead.js in my Ember app, but am not sure how to have it utilize my ember-data RESTAdapter model that I've already set up to query my database via our internal API.
Would I put a query in the "local" item to do this, maybe like below (coffeescript)?
$('.typeahead.userGrp').typeahead(
[
name: "Users and Groups"
valueKey: 'namevalue'
minLength: 1
limit: 30
template: hTemplate
local: ->
@get('store').find('userGrp')
engine: Handlebars
]
)
Or would I have to stick to an old-fashioned JQuery AJAX call, as described here? Something about the above code doesn't sit right with me, but I'd like to use ember/ember-data's built-in stuff as much as possible.
Also, as a side thought on this question, it seems that if I can get my ember-data adapter working, I'd handle the dynamic URL parts in the RESTAdapter's 'buildURL' function but if not, I'd do it in the 'typeahead.remote.replace' function. Would that make sense?
Any thoughts on this?
Bryan