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

add onBeforeSelect callback #1075

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

jnelson
Copy link

@jnelson jnelson commented Jul 8, 2015

Adds an onBeforeSelect callback to allow intercepting a selection. Ensures
access to both the prospective new selection and the current selection.

This is a preliminary offer for #1071 - let me know if you'd like any additional tests, style changes, etc.

Features:

  • provides a way to access both the incoming selection and the current selection, e.g.:
    • $scope.confirmMatch = function(currentSelection, incomingSelection) { ...
    • <ui-select on-before-select="confirmMatch($select.selected, $item)" ...
  • defaults to completing the selection
  • allows aborting the selection synchronously by returning falsy
  • allows fulfilling or aborting the selection asynchronously by returning a $q promise

Adds an onBeforeSelect callback to allow intercepting a selection. Ensures
access to both the prospective new selection and the current selection.
@jnelson
Copy link
Author

jnelson commented Jul 9, 2015

Updated the features explanation above to match code at this point.

@entrity
Copy link

entrity commented Aug 3, 2015

👍

@wesleycho
Copy link
Contributor

This needs squashing and rebasing.

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

Successfully merging this pull request may close these issues.

3 participants