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

Commit c7cfe55

Browse files
committed
Documented node selection support
1 parent 733fa92 commit c7cfe55

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

REAME.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,47 @@ will result in the following HTML:
109109
</ul>
110110
```
111111

112+
## Selection
113+
114+
Tree items can be selected and deselected if a selection change
115+
expression is provided. If no select expression is provided, selection
116+
support will not be enabled.
117+
118+
The 'select' attribute must be an expression that is evaluated in the
119+
scope of the tree node that was selected/deselected. The 'this' variable
120+
of the expression will be the scope of the tree node. A special scope
121+
variable '$selected' is set to true if the item is selected and false
122+
if not.
123+
124+
```html
125+
<ul ng-tree="model">
126+
<li select="selected()">{{item.name}}</li>
127+
</ul>
128+
```
129+
130+
```javascript
131+
$scope.selected = function () {
132+
console.log(this.item.name + ' is selected: ' + this.$selected);
133+
};
134+
```
135+
136+
### Multiple Selection
137+
138+
Multiple tree nodes can be selected at once by enabling mutli-selection
139+
on the tree.
140+
141+
When enabled, holding down the meta key (Control/Command key) allows
142+
the user to select multiple tree nodes.
143+
144+
Note: a 'select' expression must be provided to enable selection support
145+
for the tree.
146+
147+
```html
148+
<ul ng-tree="model" multiple>
149+
<li select="selected()">{{item.name}}</li>
150+
</ul>
151+
```
152+
112153
# License
113154

114155
The MIT License (MIT)

0 commit comments

Comments
 (0)