-
Notifications
You must be signed in to change notification settings - Fork 723
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
Updated to 0.9, now getting t.choices
is not a function
#778
Comments
t.choices
is not a functiont.choices
is not a function
I really wonder about your error. I've never seen it myself. And it seems that it doesn't set a |
Angular 1.4.5. What you said in the PR makes sense, but I definitely got that error consistently. I'll try upgrading again later today. |
BTW: I didn't think |
Why is it a mistake? |
That's why. ng-admin is tested on angular 1.3. Migration to 1.4 is not yet started (cf #567) |
Because it's a function created on the scope to call back the expression, and it's being overridden with a static property, breaking the binding. It makes the logic harder to follow, too, because it switches from a function to an array at some point. Really? I thought I just read that v0.9 was going to be the switch to ng 1.4, since 0.8 was the last to support 1.3.x. That sucks for me. 😦 |
OK, this fix worked for me on Angular 1.4.7: var choices = (angular.isFunction(scope.choices) && scope.choices()) ? scope.choices : (field.choices ? field.choices() : []) |
That still doesn't make sense. Does the following work? var choices = (typeof scope.choices == 'function' && scope.choices()) ? scope.choices() : (field.choices ? field.choices() : []); 0.8 was supposed to be the latest version built on Angular 1.3, but we packed too many features in 0.9 not to release it before breaking compatibility. You'll have to wait a bit for 1.4 compatibility. |
Note: I tracked down the BC Break in Angular 1.4 to this commit: angular/angular.js@6a38dbf |
Yup, looks like that's the change. The code from above is almost the same thing as mine, I'm just using Angular's built-in The other difference is you are calling // existing code
var choices = scope.choices() ? scope.choices : (field.choices ? field.choices() : []); |
Thank you, sir! :-) |
This fix is not yet added to built files and cannot be easily installed via Bower, I presume?.. |
It is added to built files. To get it from bower, you must reference the master branch (see http://stackoverflow.com/a/16951315 for directions). |
I've tried and that didn't work - built files were updated 20 days ago and the fix was added 19 days ago... |
It should be fixed by now, I've published a new build a couple days ago. |
I'm reading the documentation (Getting-started chapter) and i have the same error when i tried to display the users filter in the post listview section. I am using angularjs 1.5.0 Edit: I have this bug too with angularjs 1.4.5. |
Every time I switch to an edit page, I'm now getting this error:
I've narrowed it down to line 36 of maChoiceField.js. I don't know exactly what's wrong. I think it's a mistake, because it calls the function then uses the result.
Looks like the change was made in commit 0f06936.
If it matters, these fields are using a custom function for the choices. It's a bit of a hack to allow me to asynchronously load some meta data from the server, but it shouldn't affect anything. The way it works is like this:
I'd make a minimal test case, but I'm honestly trying to figure out how to do that, since you need a RESTful backend.
The text was updated successfully, but these errors were encountered: