Comments (3)
Hi Bram,
I understand your problem. Some people also asked me more or less the same thing. They need this "on-change" or "on-item-click" or sort - basically a callback when you select or deselect an item.
I am going to include this feature on the next release. For now you can use $watch. Don't forget to set the third parameter to "true":
$scope.$watch( $yourModel, yourListenerFunction(), true );
The reason I am going to add that "on-change" or "on-item-click" callback is because $watch with the third parameter set to "true" affects performance, especially on models with complex structure.
At the moment I am working on the next version of this directive, which will add:
- the on-item-click callback. This callback will pass the item that you click as a parameter.
- Unlimited nested grouping.
- Better keyboard control (using up & down arrow)
- Some clean ups & optimizations (Still, don't expect it to win any code performance competition).
- May remove some non-popular features such as on-focus or on-blur
Do star this repository so that you can get update on the new version.
Lastly, I saw your profile and I understand that you are new on Github, so welcome!
Regards,
Steven
from angular-multi-select.
Hi @Werewolfkiss,
I think you can use the on-open callback for this purpose.
Remove the ng-click
attribute and add on-open="getDataByUser(selectedUserList)"
attribute.
from angular-multi-select.
Hello Steven,
I do want the function to be called on each selection change, so not only
when the entire menu is opened.
So on-open doesnt work for me. I also tried on-blur, but that is totally
unpredictable.
I do notice that with ng-click, the function gets called once with the old
selectedUserList and once with the updated selectedUserList.
So when nothing is selected and I select user1:
- getDataByUser([])
- getDataByUser([user1])
And if I then select user2
- getDataByUser([user1])
- getDataByUser([user1, user2])
And then deselect user1
- getDataByUser([user1,user2])
- getDataByUser([user2])
I guess I might be able to work around it with a
$scope.$watch($selectedUserList, getDataByUser($selectedUserList)), but i'd
rather have it work properly from inside the multi-select.
Kind regards,
Bram Verspeek
On Mon, Jun 23, 2014 at 5:04 PM, Steven [email protected] wrote:
Hi @Werewolfkiss https://github.com/Werewolfkiss,
I think you can use the on-open callback for this purpose.
Remove the ng-click attribute and add
on-open="getDataByUser(selectedUserList)" attribute.—
Reply to this email directly or view it on GitHub
#27 (comment)
.
from angular-multi-select.
Related Issues (20)
- How to add tooltip for each dropdown element? HOT 9
- how to add default text when data is not bound to multiselect? HOT 1
- Reset doesn't set all values' 'ticked' property to false HOT 2
- output-model needn't be a compulsory attribute HOT 4
- Is there any angular 4 version of this available ? HOT 2
- Use same input-model to multiple multiselectors? HOT 4
- Select items from single group only
- XSS attack by option name
- Mutli select not support direction
- how to select all items loaded on the control??
- How to prevent .length == 'undefined' error when populating dropdown via on-open
- Filtering problem when grouped
- Grouping
- Issue injecting multi-select directive into another directive with same scope
- make filter clear button 'x' icon encoded
- Possible to launch dropdown from custom button?
- will it be possible to give remove option to the selected items in the ui HOT 1
- Search not working when grouping is enabled.
- Any ways to dynamically update helper-elements?
- Multiple elements selected when only one is clicked HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-multi-select.