Skip to content
This repository has been archived by the owner on Oct 2, 2019. It is now read-only.

feature proposal: onBeforeSelect callback #1071

Open
jnelson opened this issue Jul 8, 2015 · 3 comments
Open

feature proposal: onBeforeSelect callback #1071

jnelson opened this issue Jul 8, 2015 · 3 comments

Comments

@jnelson
Copy link

jnelson commented Jul 8, 2015

Would you be willing to consider a PR for an onBeforeSelect callback? This would provide a way to access both the selection and the current value, potentially aborting the selection. If you try to track this externally it can get complicated (mostly due to assumptions about the target model's behavior) but the internal solution is fairly simple.

Implementation would include a check for a $q promise property and complete the selection when the promise is resolved or abort the selection in the case of a reject. (Without the promise, selection would be aborted via a falsey return value.)

@Calvin-he
Copy link

I have the same requirement as you @jnelson .

when selecting a item, the item should select or not , which depends on some conditions. In another word, when not satisfy some conditions it keeps original selected item.
I know ui-select have an event named 'on-select', but it is the 'after selected callback'

I wonder where I should add the callback in the select.js?

@jnelson
Copy link
Author

jnelson commented Jul 8, 2015

@Calvin-he If you're in a hurry, see the PR at #1075 .

@wesleycho
Copy link
Contributor

This sounds like a poor direction to go on - this is probably an indication that something else might be missing, as adding config to override config can only spiral.

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

No branches or pull requests

3 participants