You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 20, 2018. It is now read-only.
* allow to create own template for tree item (if not specify it use default) - look in demo
16
-
* input option _disableContextMenu_ to disable context menu (default: false)
17
-
* update Demo - add alternative view of tree
18
-
19
-
### v0.7.0
20
-
21
-
* remove API config service (see section _Usage_)
22
-
23
-
### v0.6.2
24
-
25
-
* change name FolderService to NodeService
26
-
* change params names from _dirId_ to _nodeId_
27
-
* now you can use in your API paths parameter _{nodeId}_ which will be replaced on _nodeId_
28
-
29
-
### v0.6.1
30
-
31
-
* expose _ConfigService_ - it allow override urls for create, edit, and delete folder
32
-
33
-
### v0.6.0
3
+
## Demo
34
4
35
-
* upgrade angular/cli to version _beta.32.3_
36
-
* fix demo
5
+
Working demo with _local storage_ you can find [here](https://qjon.github.io/angular2-tree/).
37
6
38
-
### v0.5.0
7
+
##Installation
39
8
40
-
* primary version with all features described below.
9
+
npm i @rign/angular2-tree
10
+
41
11
42
12
## Usage
43
13
44
-
Include _TreeModule_ in your application module;
14
+
Include _TreeModule_ in your application module and create Store
45
15
46
16
import {TreeModule} from '@rign/angular2-tree/main';
47
17
@@ -51,22 +21,14 @@ Include _TreeModule_ in your application module;
51
21
],
52
22
imports: [
53
23
...
54
-
TreeModule
24
+
TreeModule,
25
+
StoreModule.provideStore({trees: treeReducer})
55
26
]
56
27
})
57
28
58
29
In any html file put
59
30
60
-
<rign-tree
61
-
[showAddButton]="true"
62
-
[nodes]="folders"
63
-
[menu]="contextMenu"
64
-
(onAdd)="onAdd($event)"
65
-
(onChange)="onChange($event)"
66
-
(onRemove)="onRemove($event)"
67
-
(onToggle)="onToggle($event)"
68
-
(onSelect)="onSelect($event)"
69
-
></rign-tree>
31
+
<rign-tree [treeModel]="treeModel"></rign-tree>
70
32
71
33
Create your own loader service as it is done in example
72
34
@@ -80,13 +42,53 @@ Create your own loader service as it is done in example
80
42
}
81
43
}
82
44
83
-
and use it to load data.
45
+
and use it to load data. Or you can extend and rewrite all methods of that service to store your data wherever you want. See example _localStorage.service.ts_
46
+
47
+
48
+
In component where you create tree, you should register _tree store_, create _TreeModel_ and load root tree
49
+
50
+
export class MyTreeComponent implements OnInit {
51
+
public folders: Observable<ITreeData>;
52
+
53
+
public contextMenu: IContextMenu[] = [];
54
+
55
+
public treeConfiguration: IConfiguration = {
56
+
showAddButton: true,
57
+
disableMoveNodes: false,
58
+
treeId: 'tree3',
59
+
dragZone: 'tree3',
60
+
dropZone: ['tree3']
61
+
};
62
+
63
+
public treeModel: TreeModel;
64
+
65
+
public constructor(private store: Store<ITreeState>,
0 commit comments