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

fix(uiSelectController): invoke onRemove callback method for single s… #1977

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kuuurt13
Copy link

…elect on clear selection

Closes #1225

scope.$model = $model;
};

var el = compileTemplate(
Copy link
Contributor

Choose a reason for hiding this comment

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

Cloud you use the createuiSelect function instead of the comileTemplate?

Copy link
Author

Choose a reason for hiding this comment

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

Sure, no problem. Updated test to use createUiSelect instead.

ctrl.select(null);
$event.stopPropagation();
$timeout(function() {
ctrl.onRemoveCallback($scope, {
Copy link
Contributor

@Jefiozie Jefiozie Jun 7, 2017

Choose a reason for hiding this comment

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

Could this function been refactored to be on the uiSingleSelect directive?

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean then the clear function. As the uiSelectMultiple has his own remove function. I think it would be good to keep this kind of functionality on the correct place. What do you think?

Copy link
Author

Choose a reason for hiding this comment

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

@Jefiozie I see what you are saying. I might be overlooking something here but it seems to me that uiSelectMultiple has the removeChoice method on its controller and then the uiSelectMatchDirective view uses the uiSelectMultiple controller to call it like so ng-click="$selectMultiple.removeChoice($index)".

Currently uiSingleSelect doesn't have a controller so I would have to add the method directly to the scope of uiSingleSelect in the link function. Then I would call it from the uiSelectMatchDirective single view like so ng-click="remove($event)". I just haven't seen too many methods bound directly to the scope in the library so I wasn't sure if this was correct. What do you think?

@cime
Copy link

cime commented Feb 15, 2018

Anything new on this one? It's really annoying there is no way to know when clear is called...

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