Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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
rikkertkoppes wants to merge 9 commits intodump247:masterdump247/angular.tree:masterfrom
rikkertkoppes:masterrikkertkoppes/angular.tree:masterCopy head branch name to clipboard
Open

Added direct attribute and used $parse for event handling#2
rikkertkoppes wants to merge 9 commits intodump247:masterdump247/angular.tree:masterfrom
rikkertkoppes:masterrikkertkoppes/angular.tree:masterCopy head branch name to clipboard

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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.