Skip to content
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

Fixed backwards scope.choices test. Fixes #778. #779

Closed

Conversation

OverZealous
Copy link

Note: I couldn't test the code directly, because make install was erroring on me, and I don't have the time this second to dig into it.

@@ -33,7 +33,7 @@ export default function maChoiceField($compile) {
refreshAttributes = 'refresh-delay="refreshDelay" refresh="refresh({ $search: $select.search })"';
}

var choices = scope.choices() ? scope.choices : (field.choices ? field.choices() : []);
var choices = scope.choices ? scope.choices() : (field.choices ? field.choices() : []);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nah, choices being passed to the directive with an &, it's always a function. So I guess the right fix should be

var choices = scope.choices() || (field.choices ? field.choices() : []);

@OverZealous
Copy link
Author

Closing this, though the issue remains, as this PR is the wrong solution.

I think the right solution might be

(angular.isFunction(scope.choices) && scope.choices()) ? scope.choices : (field.choices ? field.choices() : []);

I'm guessing that Angular is seeing the &? and not assigning the value if it's not set, but I honestly have no idea. I have not seen &? used much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants