4
4
[ ![ Dependency Status] [ david-badge ]] [ david-badge-url ]
5
5
[ ![ devDependency Status] [ david-dev-badge ]] [ david-dev-badge-url ]
6
6
[ ![ npm] [ npm-badge ]] [ npm-badge-url ]
7
-
7
+
8
8
Prototype of a CLI for Angular 2 applications based on the [ ember-cli] ( http://www.ember-cli.com/ ) project.
9
9
10
10
## Note
@@ -57,6 +57,44 @@ Add a new pipe with:
57
57
ng generate pipe my-new-pipe
58
58
```
59
59
60
+ ### Generating a route
61
+
62
+ You can generate a new route by with the following command (note the singular
63
+ used in ` hero ` ):
64
+
65
+ ``` bash
66
+ ng generate route hero
67
+ ```
68
+
69
+ This will create a folder with a routable component (` hero-root.component.ts ` )
70
+ with two sub-routes. The file structure will be as follows:
71
+
72
+ ```
73
+ ...
74
+ |-- app
75
+ | |-- hero
76
+ | | |-- hero-detail.component.html
77
+ | | |-- hero-detail.component.css
78
+ | | |-- hero-detail.component.ts
79
+ | | |-- hero-list.component.html
80
+ | | |-- hero-list.component.css
81
+ | | |-- hero-list.component.ts
82
+ | | |-- hero-root.component.ts
83
+ | | |-- hero.service.ts
84
+ | |-- ...
85
+ |-- app.ts
86
+ ...
87
+ ```
88
+
89
+ Afterwards to use the new route open your main app component, import
90
+ ` hero-root.component.ts ` and add it in the route config:
91
+
92
+ ```
93
+ @RouteConfig([
94
+ {path:'/hero/...', name: 'HeroRoot', component: HeroRoot}
95
+ ])
96
+ ```
97
+
60
98
61
99
### Creating a build
62
100
@@ -69,17 +107,17 @@ The build artifacts will be stored in the `dist/` directory.
69
107
70
108
### Running tests
71
109
72
- Before running the tests make sure that the project is built. To build the
110
+ Before running the tests make sure that the project is built. To build the
73
111
project once you can use:
74
112
75
113
``` bash
76
114
ng build
77
115
```
78
116
79
- With the project built in the ` dist/ ` folder you can just run: ` karma start ` .
117
+ With the project built in the ` dist/ ` folder you can just run: ` karma start ` .
80
118
Karma will run the tests and keep the browser open waiting to run again.
81
119
82
- This will be easier when the command
120
+ This will be easier when the command
83
121
[ ng test] ( https://github.com/angular/angular-cli/issues/70 ) is implemented.
84
122
85
123
0 commit comments