-
-
Save matthias-k/6807d81cbaeb475cdb115ed16b8890d1 to your computer and use it in GitHub Desktop.
Access parent component in source function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import myTemplate from '../templates/suggestion-template' | |
export default Ember.Controller.extend({ | |
suggestionTemplate: myTemplate, | |
getDisplayString : function(suggestion) { | |
if(typeof suggestion === "string") | |
return suggestion; | |
return suggestion.text; | |
}, | |
updateValue: function(newValue){ | |
this.set('searchInput', getDisplayString(newValue)) | |
}, | |
actions: { | |
suggestSource: function(query, syncResults, asyncResults) { | |
// this should be the this controller | |
// but it seems to be the | |
// jquery typeahead component | |
console.log("this", this); | |
if(query == 'test') | |
syncResults([{id: 2, text: "testing is fun!"}]); | |
else | |
syncResults([{id: 1, text: "test"}]); | |
}, | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.10.1", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.6.0", | |
"ember-data": "2.6.1", | |
"ember-template-compiler": "2.6.0" | |
}, | |
"addons": { | |
"ember-aupac-typeahead": "2.0.7" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment