Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(readme): add custom node templating section #250

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* [Load children asynchronously](#load-children-asynchronously)
* [Load children using ngrx (or any redux-like library)](#load-children-using-ngrx-or-any-redux-like-library)
* [Configure node via TreeModelSettings](#configure-node-via-treemodelsettings)
* [Customize node templates](#customize-node-templates)
* [[settings]](#settings)
* [`Tree` class](#tree-class)
* [events (nodeMoved, nodeSelected, nodeRenamed, nodeRemoved, nodeCreated, nodeExpanded, nodeCollapsed)](#events-nodemoved-nodeselected-noderenamed-noderemoved-nodecreated-nodeexpanded-nodecollapsed)
Expand Down Expand Up @@ -362,6 +363,18 @@ Here is an example of its usage:

All options that are defined on a `parent` are automatically applied to children. If you want you can override them by `settings` of the child node.

#### Customize node templates

You can customize how the nodes render via content transclusion:

```html
<tree [tree]="tree">
<ng-template let-node>
<b class="custom-node">{{node.value}}</b>
</ng-template>
</tree>
```

### [settings]

Object that should be passed to `[settings]` must be of type [`Ng2TreeSettings`](src/tree.types.ts). This attribute is **optional**. Right now only one setting is available in there - `rootIsVisible`. This setting allows you to make a root node of the tree _invisible_:
Expand Down