Skip to content
This repository was archived by the owner on Oct 22, 2020. It is now read-only.

Added direct attribute and used $parse for event handling #2

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

Conversation

rikkertkoppes
Copy link

I added a direct attribute to be able to prevent the need for modifier keys. E.g.

<ul ng-tree="model" multiple direct>

will always use multiple selection

Furthermore, the $event is now sent along with the select handler. This way, one can do

<ul ng-tree="model">
    <li select="selected($event)">{{item.name}}</li>
</ul>
$scope.selected = function (e) {
    console.log(this.item.name + ' is selected: ' + this.$selected);
    console.log('event',e);
};

@rikkertkoppes
Copy link
Author

Also added an option to redefine the property that is used as selected. this defaults to $selected as before.

<li select="onSelect($event)"
    selected="item.selected">
</li>

Looking at the code, this has been the intention thus far, but never implemented

@dump247
Copy link
Owner

dump247 commented Mar 25, 2013

Looks good. My only comment is that I don't really like having a separate multiple and direct attributes, where direct only serves to modify multiple and has no meaning without it. It seems like multiple should have different values in this case. For example: "key" (the default, equivalent to "true" and ""), "direct", and "false" (equivalent to no attribute). The values "key" and "direct" don't feel very descriptive, but I can't think of anything better.

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.

2 participants