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
docs: update getting started tutorial to use StackBlitz web-containers (angular#44085)
Previous commits changed the docs to use web-container versions for StackBlitz examples.
This commit updates the content of the tutorial to match.
Fixesangular#44079
PR Closeangular#44085
Copy file name to clipboardExpand all lines: aio/content/start/index.md
+16-5Lines changed: 16 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,6 +53,10 @@ To save your work:
53
53
1. Fork the project you generated.
54
54
1. Save periodically.
55
55
56
+
<divclass="lightbox">
57
+
<imgsrc="generated/images/guide/start/fork-the-project.png"alt="Fork the project">
58
+
</div>
59
+
56
60
In StackBlitz, the preview pane on the right shows the starting state of the example application.
57
61
The preview features two areas:
58
62
@@ -162,13 +166,20 @@ The alert checks the product's price, and, if the price is greater than $700, di
162
166
163
167
This section walks you through creating a child component, `ProductAlertsComponent` that can receive data from its parent component, `ProductListComponent`.
164
168
165
-
1.Right click on the `app` folder and use the `Angular Generator` to generate a new component named `product-alerts`.
169
+
1.Click on the plus sign above the current terminal to create a new terminal to run the command to generate the component.
166
170
167
171
<divclass="lightbox">
168
-
<img src="http://github.com/generated/images/guide/start/%3Cspan%20class="x x-first x-last">generate-component.png" alt="StackBlitz command to generate component">
172
+
<img src="http://github.com/generated/images/guide/start/%3Cspan%20class="x x-first x-last">create-new-terminal.png" alt="StackBlitz command to generate component">
169
173
</div>
170
174
171
-
The generator creates starter files for the three parts of the component:
175
+
1. In the new terminal, generate a new component named `product-alerts` by running the following command.
176
+
177
+
```sh
178
+
ng generate component product-alerts
179
+
```
180
+
181
+
The generator creates starter files for the three parts of the component:
182
+
172
183
* `product-alerts.component.ts`
173
184
* `product-alerts.component.html`
174
185
* `product-alerts.component.css`
@@ -199,11 +210,11 @@ This section walks you through creating a child component, `ProductAlertsCompone
1. Finally, to display `ProductAlertsComponent` as a child of `ProductListComponent`, add the selector, `<app-product-alerts>` to `product-list.component.html`.
217
+
1. Finally, to display `ProductAlertsComponent` as a child of `ProductListComponent`, add the `<app-product-alerts>` element to `product-list.component.html`.
207
218
Pass the current product as input to the component using property binding.
1. In the terminal generate a new `cart`service by running the following command:
32
31
33
-
1. Import the `Product` interface from `./products.js`.
34
-
1. In the `CartService` class, define an `items` property to store the array of the current products in the cart.
32
+
```sh
33
+
ng generate service cart
34
+
```
35
+
36
+
1. Import the `Product` interface from `./products.ts` into the `cart.service.ts` file, and in the `CartService` class, define an `items` property to store the array of the current products in the cart.
There's no link to the new shipping component yet, but you can see its template in the preview pane by entering the URL its route specifies.
243
-
The URL has the pattern: `https://getting-started.stackblitz.io/shipping` where the `getting-started.stackblitz.io` part may be different for your StackBlitz project.
257
+
The URL has the pattern: `https://angular-ynqttp--4200.local.webcontainer.io/shipping` where the `angular-ynqttp--4200.local.webcontainer.io` part may be different for your StackBlitz project.
244
258
245
259
### Configuring the `ShippingComponent` to use `CartService`
Copy file name to clipboardExpand all lines: aio/content/start/start-deployment.md
+9-8Lines changed: 9 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,25 +20,26 @@ A best practice is to run your project locally before you deploy it. To run your
20
20
21
21
## Running your application locally
22
22
23
-
1. Download the source code from your StackBlitz project by clicking the `Download Project` icon in the left menu, across from `Project`, to download your files.
23
+
1. Download the source code from your StackBlitz project by clicking the `Download Project` icon in the left menu, across from `Project`, to download your project as a zip archive.
24
24
25
-
1. Create a new Angular CLI workspace using the [`ng new`](cli/new "CLI ng new command reference") command, where `my-project-name` is what you would like to call your project:
25
+
<div class="lightbox">
26
+
<img src="generated/images/guide/start/download-project.png" alt="Download the stackblitz project">
27
+
</div>
28
+
29
+
30
+
1. Unzip the archive change directory to the newly created project. For example:
26
31
27
32
```sh
28
-
ng new my-project-name
33
+
cd angular-ynqttp
29
34
```
30
35
31
-
This command displays a series of configuration prompts. For this tutorial, accept the default settings for each prompt.
32
-
33
-
1. In your newly CLI-generated application, replace the `/src` folder with the `/src` folder from your `StackBlitz` download.
34
-
35
36
1. Use the following CLI command to run your application locally:
36
37
37
38
```sh
38
39
ng serve
39
40
```
40
41
41
-
1. To see your application in the browser, go to http://localhost:4200/.
42
+
1. To see your application in the browser, go to http://localhost:4200/.
42
43
If the default port 4200 is not available, you can specify another port with the port flag as in the following example:
Copy file name to clipboardExpand all lines: aio/content/start/start-routing.md
+6-3Lines changed: 6 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,10 +18,13 @@ The application already uses the Angular `Router` to navigate to the `ProductLis
18
18
This section shows you how to define a route to show individual product details.
19
19
20
20
1. Generate a new component for product details.
21
-
In the file list, right-click the `app` folder, choose `Angular Generator` and `Component`.
22
-
Name the component `product-details`.
21
+
In the terminal generate a new `product-details` component by running the following command:
23
22
24
-
1. In `app.module.ts`, add a route for product details, with a `path` of `products/:productId` and `ProductDetailsComponent` for the `component`, include `ProductDetailsComponent` in `AppModule`'s declarations.
23
+
```sh
24
+
ng generate component product-details
25
+
```
26
+
27
+
1. In `app.module.ts`, add a route for product details, with a `path` of `products/:productId` and `ProductDetailsComponent`for the `component`.
0 commit comments