11include _util-fns
2-
2+
33:marked
44 Good tools make application development quicker and easier to maintain than
55 if you did everything by hand.
6-
6+
77 The [**Angular CLI**](https://cli.angular.io/) is a **_command line interface_** tool
8- that can create a project, add files, and perform a variety of ongoing development tasks such
8+ that can create a project, add files, and perform a variety of ongoing development tasks such
99 as testing, bundling, and deployment.
10-
11- The goal in this guide is to build and run a simple Angular
12- application in TypeScript, using the Angular CLI
10+
11+ The goal in this guide is to build and run a simple Angular
12+ application in TypeScript, using the Angular CLI
1313 while adhering to the [Style Guide](./guide/style-guide.html) recommendations that
1414 benefit _every_ Angular project.
15-
15+
1616 By the end of the chapter, you'll have a basic understanding of development with the CLI
1717 and a foundation for both these documentation samples and for real world applications.
1818
1919 You'll pursue these ends in the following high-level steps:
20-
20+
2121 1. [Set up](#devenv) the development environment.
2222 2. [Create](#create-proj) a new project and skeleton application.
2323 3. [Serve](#serve) the application.
@@ -29,7 +29,7 @@ include _util-fns
2929h2#devenv Step 1. Set up the Development Environment
3030:marked
3131 You need to set up your development environment before you can do anything.
32-
32+
3333 Install **[Node.js® and npm](https://nodejs.org/en/download/)**
3434 if they are not already on your machine.
3535.l-sub-section
@@ -39,10 +39,10 @@ h2#devenv Step 1. Set up the Development Environment
3939 Older versions produce errors, but newer versions are fine.
4040:marked
4141 Then **install the [Angular CLI](https://github.com/angular/angular-cli)** globally.
42-
42+
4343code-example( language ="sh" class ="code-shell" ) .
4444 npm install -g @angular/cli
45-
45+
4646.l-main-section
4747h2#create-project Step 2. Create a new project
4848:marked
@@ -56,7 +56,7 @@ code-example(language="sh" class="code-shell").
5656
5757.l-sub-section
5858 :marked
59- Patience please.
59+ Patience please.
6060 It takes time to set up a new project, most of it spent installing npm packages.
6161
6262.l-main-section
@@ -67,41 +67,41 @@ h2#serve Step 3: Serve the application
6767code-example( language ="sh" class ="code-shell" ) .
6868 cd my-app
6969 ng serve --open
70-
70+
7171:marked
72- The `ng serve` command launches the server, watches your files,
72+ The `ng serve` command launches the server, watches your files,
7373 and rebuilds the app as you make changes to those files.
7474
75- Using the `--open` (or just `-o`) option will automatically open your browser
76- on `http://localhost:4200/`.
77-
75+ Using the `--open` (or just `-o`) option will automatically open your browser
76+ on `http://localhost:4200/`.
77+
7878 Your app greets you with a message:
79-
79+
8080figure.image-display
8181 img( src ='/resources/images/devguide/cli-quickstart/app-works.png' alt ="The app works!" )
8282
8383.l-main-section
8484h2#first-component Step 4: Edit your first Angular component
8585:marked
86- The CLI created the first Angular component for you.
86+ The CLI created the first Angular component for you.
8787 This is the _root component_ and it is named `app-root`.
8888 You can find it in `./src/app/app.component.ts`.
8989
9090:marked
9191 Open the component file and change the `title` property from _app works!_ to _My First Angular App_:
92-
92+
9393+ makeExample('cli-quickstart/ts/src/app/app.component.ts' , 'title' , 'src/app/app.component.ts' )( format ="." )
9494
9595:marked
9696 The browser reloads automatically with the revised title. That's nice, but it could look better.
97-
98- Open `src/app/cli-quickstart .component.css` and give the component some style.
97+
98+ Open `src/app/app .component.css` and give the component some style.
9999
100100+ makeExample('cli-quickstart/ts/src/app/app.component.css' , null , 'src/app/app.component.css' )( format ="." )
101101
102102figure.image-display
103- img( src ='/resources/images/devguide/cli-quickstart/my-first-app.png' alt ="Output of QuickStart app" )
104-
103+ img( src ='/resources/images/devguide/cli-quickstart/my-first-app.png' alt ="Output of QuickStart app" )
104+
105105:marked
106106 Looking good!
107107
@@ -123,11 +123,11 @@ figure.image-display
123123
124124 The first file you should check out is `README.md`.
125125 It has some basic information on how to use CLI commands.
126- Whenever you want to know more about how Angular CLI works make sure to visit
127- [the Angular CLI repository](https://github.com/angular/angular-cli) and
126+ Whenever you want to know more about how Angular CLI works make sure to visit
127+ [the Angular CLI repository](https://github.com/angular/angular-cli) and
128128 [Wiki](https://github.com/angular/angular-cli/wiki).
129129
130- Some of the generated files might be unfamiliar to you.
130+ Some of the generated files might be unfamiliar to you.
131131
132132block src-files
133133 :marked
@@ -175,7 +175,7 @@ table(width="100%")
175175 :marked
176176 Defines the `AppComponent` along with an HTML template, CSS stylesheet, and a unit test.
177177 It is the **root** component of what will become a tree of nested components
178- as the application evolves.
178+ as the application evolves.
179179 tr
180180 td <code >app/app.module.ts</code >
181181 td
@@ -187,16 +187,16 @@ table(width="100%")
187187 td <code >assets/*</code >
188188 td
189189 :marked
190- A folder where you can put images and anything else to be copied wholesale
191- when you build your application.
190+ A folder where you can put images and anything else to be copied wholesale
191+ when you build your application.
192192 tr
193193 td <code >environments/*</code >
194194 td
195195 :marked
196196 This folder contains one file for each of your destination environments,
197197 each exporting simple configuration variables to use in your application.
198198 The files are replaced on-the-fly when you build your app.
199- You might use a different API endpoint for development than you do for production
199+ You might use a different API endpoint for development than you do for production
200200 or maybe different analytics tokens.
201201 You might even use some mock services.
202202 Either way, the CLI has you covered.
@@ -212,7 +212,7 @@ table(width="100%")
212212 :marked
213213 The main HTML page that is served when someone visits your site.
214214 Most of the time you'll never need to edit it.
215- The CLI automatically adds all `js` and `css` files when building your app so you
215+ The CLI automatically adds all `js` and `css` files when building your app so you
216216 never need to add any `<script>` or `<link>` tags here manually.
217217 tr
218218 td <code >main.ts</code >
@@ -235,7 +235,7 @@ table(width="100%")
235235 td <code >styles.css</code >
236236 td
237237 :marked
238- Your global styles go here.
238+ Your global styles go here.
239239 Most of the time you'll want to have local styles in your components for easier maintenance,
240240 but styles that affect all of your app need to be in a central place.
241241 tr
@@ -249,15 +249,15 @@ table(width="100%")
249249 td <code >tsconfig.{app|spec}.json</code >
250250 td
251251 :marked
252- TypeScript compiler configuration for the Angular app (`tsconfig.app.json`)
252+ TypeScript compiler configuration for the Angular app (`tsconfig.app.json`)
253253 and for the unit tests (`tsconfig.spec.json`).
254254
255255
256256block root-files
257257 :marked
258258 ### The root folder
259- The `src/` folder is just one of the items inside the project's root folder.
260- Other files help you build, test, maintain, document, and deploy the app.
259+ The `src/` folder is just one of the items inside the project's root folder.
260+ Other files help you build, test, maintain, document, and deploy the app.
261261 These files go in the root folder next to `src/`.
262262
263263.filetree
@@ -277,8 +277,8 @@ block root-files
277277 .file package.json
278278 .file protractor.conf.js
279279 .file README.md
280- .file tsconfig.json
281- .file tslint.json
280+ .file tsconfig.json
281+ .file tslint.json
282282
283283style td, th {vertical-align: top}
284284table( width ="100%" )
@@ -291,15 +291,15 @@ table(width="100%")
291291 td <code >e2e/</code >
292292 td
293293 :marked
294- Inside `e2e/` live the End-to-End tests.
294+ Inside `e2e/` live the End-to-End tests.
295295 They shouldn't be inside `src/` because e2e tests are really a separate app that
296- just so happens to test your main app.
296+ just so happens to test your main app.
297297 That's also why they have their own `tsconfig.e2e.json`.
298298 tr
299299 td <code >node_modules/</code >
300300 td
301301 :marked
302- `Node.js` creates this folder and puts all third party modules listed in
302+ `Node.js` creates this folder and puts all third party modules listed in
303303 `package.json` inside of it.
304304 tr
305305 td <code >.angular-cli.json</code >
@@ -359,11 +359,11 @@ table(width="100%")
359359 Linting configuration for [TSLint](https://palantir.github.io/tslint/) together with
360360 [Codelyzer](http://codelyzer.com/), used when running `ng lint`.
361361 Linting helps keep your code style consistent.
362-
362+
363363.l-sub-section
364364 :marked
365365 ### Next Step
366366
367- If you're new to Angular, continue on the
368- [learning path](guide/learning-angular.html "Angular learning path").
367+ If you're new to Angular, continue on the
368+ [learning path](guide/learning-angular.html "Angular learning path").
369369 You can skip the "Setup" step since you're already using the Angular CLI setup.
0 commit comments