-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot use "this" inside countrySource method #69
Comments
"this" is probably bound to a different context than the ember object. It is a javascript issue rather than an ember one. You can fix it in a number of ways including binding the function to a specific context |
@Philosopher-G33k, does this work for you?
|
I'm struggling with the same thing right now. @veelci, that solution won't work because it's being called from the component and is provided from the template without an opportunity to provide a bound context. Doing the lamda function there only provides the function with the context of the component. |
@csprocket777 What version of Ember are you using? |
Hi,
I am unable to use "this" inside countrySource method.
using this.get or calling this.somefunction gives error.
In hbs file:
{{aupac-typeahead action=(action (mut searchCriteria)) class='form-control' source=countrySource placeholder='Search for a country'}}
In component js:
countrySource : function(query, syncResults, asyncResults) { console.log(query); console.log(this.get("searchCriteria")); //syncResults(results); },
The error which i am getting is:
TypeError: this.get is not a function
Can anyone please point out if I am missing anything?
Am new to Ember and have exhausted all search possibilities.
Update: I understand that "this" in countrySource method is jquery context. Is there any way to get controller context in this method.
Regards
The text was updated successfully, but these errors were encountered: