Skip to content

Commit 8d919c9

Browse files
authored
Update README.md
Related Issue: #1
1 parent b871fa6 commit 8d919c9

File tree

1 file changed

+79
-20
lines changed

1 file changed

+79
-20
lines changed

README.md

Lines changed: 79 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Ng2 File Tree [![CircleCI](https://circleci.com/gh/travelist/ng2-directory-tree.svg?style=svg&circle-token=c554ebe845b53a2e0db4bc4961ca1747c25168ea)](https://circleci.com/gh/travelist/ng2-directory-tree)
1+
# NG2 File Tree [![CircleCI](https://circleci.com/gh/travelist/ng2-directory-tree.svg?style=svg&circle-token=c554ebe845b53a2e0db4bc4961ca1747c25168ea)](https://circleci.com/gh/travelist/ng2-directory-tree)
22

33
Angular2 Component for rendering directory tree
44

@@ -7,49 +7,108 @@ Angular2 Component for rendering directory tree
77

88
Please feel free to open issues for new features, requirements, and bug reports. Will deal with them accordingly.
99

10+
## Installation
1011

11-
### Usage
12+
In `package.json`, add following lines in the `dependencies` block:
1213

1314
```
14-
"ng2-directory-tree": "*"
15+
"font-awesome": "~4.7.0" # Use any versions
16+
"ng2-file-tree": "~0.4.0"
1517
```
1618

19+
### [Angular2 QuickStart](https://angular.io/docs/ts/latest/quickstart.html)
20+
1721
```html
18-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
22+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
1923
```
2024

21-
```javascript
22-
// systemjs.config.js
25+
We can import this library using SystemJS (`systemjs.config.js`):
2326

24-
var map = {
25-
...
27+
```javascript
28+
// This example is following to Angular2 Quick Start Documentation
29+
30+
(function (global) {
31+
System.config({
32+
paths: {
33+
'npm:': 'node_modules/'
34+
},
35+
map: {
36+
app: 'app',
37+
38+
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
39+
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
40+
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
41+
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
42+
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
43+
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
44+
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
45+
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
46+
'@angular/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.js',
47+
48+
'rxjs': 'npm:rxjs',
49+
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api',
50+
51+
// Add this line (1/2)
52+
'ng2-file-tree': 'node_modules/ng2-file-tree',
53+
},
54+
packages: {
55+
app: {
56+
main: './main.js',
57+
defaultExtension: 'js'
58+
},
59+
rxjs: {
60+
defaultExtension: 'js'
61+
},
62+
'angular-in-memory-web-api': {
63+
main: './index.js',
64+
defaultExtension: 'js'
65+
},
66+
67+
// Add this line (2/2)
68+
'ng2-file-tree': { defaultExtension: 'js' }
69+
}
70+
});
71+
})(this);
2672

27-
'ng2-directory-tree': 'node_modules/ng2-directory-tree'
28-
};
73+
```
2974

30-
var packages = {
31-
...
75+
### [Angular CLI](https://github.com/angular/angular-cli)
3276

33-
'ng2-directory-tree': { main: 'ng2-directory-tree', defaultExtension: 'js' }
34-
};
77+
1. `../node_modules/font-awesome/css/font-awesome.css` to **style** block of *angular-cli.json*.
78+
2. `../node_modules/font-awesome/fonts/*.+(otf|eot|svg|ttf|woff|woff2)` to **addons** block of *angular-cli.json*.
3579

80+
```json
81+
/* angular-cli.json */
82+
{
83+
"apps": [
84+
{
85+
"styles": [
86+
"../node_modules/font-awesome/css/font-awesome.css"
87+
]
88+
}
89+
],
90+
"addons": [
91+
"../node_modules/font-awesome/fonts/*.+(otf|eot|svg|ttf|woff|woff2)"
92+
]
93+
}
3694
```
3795

96+
## Usage
3897

3998
```javascript
4099
import { Component } from '@angular/core';
41-
import { FileTreeComponent } from 'ng2-directory-tree'
100+
import { FileTreeComponent } from 'ng2-file-tree'
42101

43102
@Component({
44103
selector: 'my-app',
45-
template: `<directory-tree [directory]="dir"
46-
(onChange)="logging($event)"
47-
[keyboardWatch]=true>
48-
</directory-tree>`,
104+
template: `<file-tree [tree]="fileTree"
105+
(onChange)="logging($event)"
106+
[keyboardWatch]=true>
107+
</file-tree>`,
49108
directives: [FileTreeComponent]
50109
})
51110
export class AppComponent {
52-
dir = {
111+
fileTree = {
53112
"name": "photos",
54113
"children": [
55114
{

0 commit comments

Comments
 (0)