Skip to content

Instantly share code, notes, and snippets.

@mockra
Created October 17, 2014 03:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mockra/1ff031800b1437cf99d1 to your computer and use it in GitHub Desktop.
Save mockra/1ff031800b1437cf99d1 to your computer and use it in GitHub Desktop.
import Ember from 'ember';
export default Ember.Controller.extend({
searchText: null,
searchResults: [],
updateResults: function() {
var self = this;
var searchText = self.get('searchText');
if (!searchText) { return; }
var encoded = encodeURIComponent(searchText);
Ember.$.get("/your/autocomplete/path?term=" + encoded, function(json) {
self.set('searchResults', json);
});
}.property('searchText')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment