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
Copy file name to clipboardExpand all lines: adev/src/content/tutorials/first-app/steps/02-Home/README.md
+21-23Lines changed: 21 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,26 +63,26 @@ In this step, you add the new component, `Home` to your app's root component, `A
63
63
64
64
In the **Edit** pane of your IDE:
65
65
66
-
1. Open `app.ts` in the editor.
67
-
1. In `app.ts`, import `Home` by adding this line to the file level imports.
66
+
1.Open `app.ts` in the editor.
67
+
1.In `app.ts`, import `Home` by adding this line to the file level imports.
68
68
69
-
<docs-codeheader="Import Home in src/app/app.ts"path="adev/src/content/tutorials/first-app/steps/03-HousingLocation/src/app/app.ts"visibleLines="[2]"/>
69
+
<docs-codeheader="Import Home in src/app/app.ts"path="adev/src/content/tutorials/first-app/steps/03-HousingLocation/src/app/app.ts"visibleLines="[2]"/>
70
70
71
-
1. In `app.ts`, in `@Component`, update the `imports` array property and add `Home`.
71
+
1.In `app.ts`, in `@Component`, update the `imports` array property and add `Home`.
72
72
73
-
<docs-codeheader="Replace in src/app/app.ts"path="adev/src/content/tutorials/first-app/steps/03-HousingLocation/src/app/app.ts"visibleLines="[6]"/>
73
+
<docs-codeheader="Replace in src/app/app.ts"path="adev/src/content/tutorials/first-app/steps/03-HousingLocation/src/app/app.ts"visibleLines="[6]"/>
74
74
75
-
1. In `app.ts`, in `@Component`, update the `template` property to include the following HTML code.
75
+
1.In `app.ts`, in `@Component`, update the `template` property to include the following HTML code.
76
76
77
-
<docs-codelanguage="angular-ts"header="Replace in src/app/app.ts"path="adev/src/content/tutorials/first-app/steps/03-HousingLocation/src/app/app.ts"visibleLines="[7,16]"/>
77
+
<docs-codelanguage="angular-ts"header="Replace in src/app/app.ts"path="adev/src/content/tutorials/first-app/steps/03-HousingLocation/src/app/app.ts"visibleLines="[7,16]"/>
78
78
79
-
1. Save your changes to `app.ts`.
80
-
1. If `ng serve` is running, the app should update.
81
-
If `ng serve` is not running, start it again.
82
-
_Hello world_ in your app should change to _home works!_ from the `Home`.
83
-
1. Check the running app in the browser and confirm that the app has been updated.
79
+
1.Save your changes to `app.ts`.
80
+
1.If `ng serve` is running, the app should update.
81
+
If `ng serve` is not running, start it again.
82
+
_Hello world_ in your app should change to _home works!_ from the `Home`.
83
+
1.Check the running app in the browser and confirm that the app has been updated.
84
84
85
-
<imgalt="browser frame of page displaying the text 'home works!'"src="assets/images/tutorials/first-app/homes-app-lesson-02-step-2.png">
85
+
<imgalt="browser frame of page displaying the text 'home works!'"src="assets/images/tutorials/first-app/homes-app-lesson-02-step-2.png">
86
86
87
87
</docs-step>
88
88
@@ -97,22 +97,20 @@ Note that, this step just adds the search elements to the layout without any fun
97
97
98
98
In the **Edit** pane of your IDE:
99
99
100
-
1. In the `first-app` directory, open `home.ts` in the editor.
101
-
1. In `home.ts`, in `@Component`, update the `template` property with this code.
100
+
1.In the `first-app` directory, open `home.ts` in the editor.
101
+
1.In `home.ts`, in `@Component`, update the `template` property with this code.
102
102
103
-
<docs-codelanguage="angular-ts"header="Replace in src/app/home/home.ts"path="adev/src/content/tutorials/first-app/steps/03-HousingLocation/src/app/home/home.ts"visibleLines="[5,12]"/>
103
+
<docs-codelanguage="angular-ts"header="Replace in src/app/home/home.ts"path="adev/src/content/tutorials/first-app/steps/03-HousingLocation/src/app/home/home.ts"visibleLines="[5,12]"/>
104
104
105
-
1. Next, open `home.css` in the editor and update the content with these styles.
105
+
1.Next, open `home.css` in the editor and update the content with these styles.
106
106
107
-
NOTE: In the browser, these can go in `src/app/home/home.ts` in the `styles` array.
107
+
NOTE: In the browser, these can go in `src/app/home/home.ts` in the `styles` array.
108
108
109
-
<docs-codeheader="Replace in src/app/home/home.css"path="adev/src/content/tutorials/first-app/steps/03-HousingLocation/src/app/home/home.css"/>
109
+
<docs-codeheader="Replace in src/app/home/home.css"path="adev/src/content/tutorials/first-app/steps/03-HousingLocation/src/app/home/home.css"/>
110
110
111
-
1. Confirm that the app builds without error.
112
-
You should find the filter query box and button in your app and they should be styled.
113
-
Correct any errors before you continue to the next step.
111
+
1. Confirm that the app builds without error. You should find the filter query box and button in your app and they should be styled. Correct any errors before you continue to the next step.
114
112
115
-
<imgalt="browser frame of homes-app displaying logo, filter text input box and search button"src="assets/images/tutorials/first-app/homes-app-lesson-02-step-3.png">
113
+
<imgalt="browser frame of homes-app displaying logo, filter text input box and search button"src="assets/images/tutorials/first-app/homes-app-lesson-02-step-3.png">
Copy file name to clipboardExpand all lines: adev/src/content/tutorials/first-app/steps/03-HousingLocation/README.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,18 +44,18 @@ In this step, you add the new component, `HousingLocation` to your app's `Home`,
44
44
45
45
In the **Edit** pane of your IDE:
46
46
47
-
1. Open `home.ts` in the editor.
48
-
1. In `home.ts`, import `HousingLocation` by adding this line to the file level imports.
47
+
1.Open `home.ts` in the editor.
48
+
1.In `home.ts`, import `HousingLocation` by adding this line to the file level imports.
49
49
50
-
<docs-codeheader="Import HousingLocation in src/app/home/home.ts"path="adev/src/content/tutorials/first-app/steps/04-interfaces/src/app/home/home.ts"visibleLines="[2]"/>
50
+
<docs-codeheader="Import HousingLocation in src/app/home/home.ts"path="adev/src/content/tutorials/first-app/steps/04-interfaces/src/app/home/home.ts"visibleLines="[2]"/>
51
51
52
-
1. Next update the `imports` property of the `@Component` metadata by adding `HousingLocation` to the array.
52
+
1.Next update the `imports` property of the `@Component` metadata by adding `HousingLocation` to the array.
53
53
54
-
<docs-codeheader="Add HousingLocation to imports array in src/app/home/home.ts"path="adev/src/content/tutorials/first-app/steps/04-interfaces/src/app/home/home.ts"visibleLines="[6]"/>
54
+
<docs-codeheader="Add HousingLocation to imports array in src/app/home/home.ts"path="adev/src/content/tutorials/first-app/steps/04-interfaces/src/app/home/home.ts"visibleLines="[6]"/>
55
55
56
-
1. Now the component is ready for use in the template for the `Home`. Update the `template` property of the `@Component` metadata to include a reference to the `<app-housing-location>` tag.
56
+
1.Now the component is ready for use in the template for the `Home`. Update the `template` property of the `@Component` metadata to include a reference to the `<app-housing-location>` tag.
57
57
58
-
<docs-codelanguage="angular-ts"header="Add housing location to the component template in src/app/home/home.ts"path="adev/src/content/tutorials/first-app/steps/04-interfaces/src/app/home/home.ts"visibleLines="[7,17]"/>
58
+
<docs-codelanguage="angular-ts"header="Add housing location to the component template in src/app/home/home.ts"path="adev/src/content/tutorials/first-app/steps/04-interfaces/src/app/home/home.ts"visibleLines="[7,17]"/>
59
59
60
60
</docs-step>
61
61
@@ -70,7 +70,7 @@ In this step, you will copy over the pre-written styles for the `HousingLocation
70
70
71
71
1. Save your code, return to the browser and confirm that the app builds without error. You should find the message "housing-location works!" rendered to the screen.Correct any errors before you continue to the next step.
72
72
73
-
<imgalt="browser frame of homes-app displaying logo, filter text input box and search button and the message 'housing-location works!"src="assets/images/tutorials/first-app/homes-app-lesson-03-step-2.png">
73
+
<imgalt="browser frame of homes-app displaying logo, filter text input box and search button and the message 'housing-location works!"src="assets/images/tutorials/first-app/homes-app-lesson-03-step-2.png">
Copy file name to clipboardExpand all lines: adev/src/content/tutorials/first-app/steps/04-interfaces/README.md
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,13 +44,13 @@ In the **Terminal** pane of your IDE:
44
44
<docs-steptitle="Add properties to the new interface">
45
45
This step adds the properties to the interface that your app needs to represent a housing location.
46
46
47
-
1. In the **Terminal** pane of your IDE, start the `ng serve` command, if it isn't already running, to build the app and serve it to `http://localhost:4200`.
48
-
1. In the **Edit** pane of your IDE, open the `src/app/housinglocation.ts` file.
49
-
1. In `housinglocation.ts`, replace the default content with the following code to make your new interface to match this example.
47
+
1.In the **Terminal** pane of your IDE, start the `ng serve` command, if it isn't already running, to build the app and serve it to `http://localhost:4200`.
48
+
1.In the **Edit** pane of your IDE, open the `src/app/housinglocation.ts` file.
49
+
1.In `housinglocation.ts`, replace the default content with the following code to make your new interface to match this example.
50
50
51
-
<docs-codeheader="Update src/app/housinglocation.ts to match this code"path="adev/src/content/tutorials/first-app/steps/05-inputs/src/app/housinglocation.ts"visibleLines="[1,10]" />
51
+
<docs-codeheader="Update src/app/housinglocation.ts to match this code"path="adev/src/content/tutorials/first-app/steps/05-inputs/src/app/housinglocation.ts"visibleLines="[1,10]" />
52
52
53
-
1. Save your changes and confirm the app does not display any errors. Correct any errors before you continue to the next step.
53
+
1.Save your changes and confirm the app does not display any errors. Correct any errors before you continue to the next step.
54
54
55
55
At this point, you've defined an interface that represents data about a housing location including an `id`, `name`, and location information.
56
56
</docs-step>
@@ -62,28 +62,28 @@ In this step, you create an instance of the interface and assign some sample dat
62
62
You won't see this sample data appear in your app yet.
63
63
There are a few more lessons to complete before that happens.
64
64
65
-
1. In the **Terminal** pane of your IDE, run the `ng serve` command, if it isn't already running, to build the app and serve your app to `http://localhost:4200`.
66
-
1. In the **Edit** pane of your IDE, open `src/app/home/home.ts`.
67
-
1. In `src/app/home/home.ts`, add this import statement after the existing `import` statements so that `Home` can use the new interface.
65
+
1.In the **Terminal** pane of your IDE, run the `ng serve` command, if it isn't already running, to build the app and serve your app to `http://localhost:4200`.
66
+
1.In the **Edit** pane of your IDE, open `src/app/home/home.ts`.
67
+
1.In `src/app/home/home.ts`, add this import statement after the existing `import` statements so that `Home` can use the new interface.
68
68
69
-
<docs-codelanguage="angular-ts"header="Import Home in src/app/home/home.ts"path="adev/src/content/tutorials/first-app/steps/05-inputs/src/app/home/home.ts"visibleLines="[3]"/>
69
+
<docs-codelanguage="angular-ts"header="Import Home in src/app/home/home.ts"path="adev/src/content/tutorials/first-app/steps/05-inputs/src/app/home/home.ts"visibleLines="[3]"/>
70
70
71
-
1. In `src/app/home/home.ts`, replace the empty `export class Home {}` definition with this code to create a single instance of the new interface in the component.
71
+
1.In `src/app/home/home.ts`, replace the empty `export class Home {}` definition with this code to create a single instance of the new interface in the component.
72
72
73
-
<docs-codelanguage="angular-ts"header="Add sample data to src/app/home/home.ts"path="adev/src/content/tutorials/first-app/steps/05-inputs/src/app/home/home.ts"visibleLines="[22,35]"/>
73
+
<docs-codelanguage="angular-ts"header="Add sample data to src/app/home/home.ts"path="adev/src/content/tutorials/first-app/steps/05-inputs/src/app/home/home.ts"visibleLines="[22,35]"/>
74
74
75
-
1. Confirm that your `home.ts` file matches this example.
75
+
1.Confirm that your `home.ts` file matches this example.
By adding the `housingLocation` property of type `HousingLocation` to the `Home` class, we're able to confirm that the data matches the description of the interface. If the data didn't satisfy the description of the interface, the IDE has enough information to give us helpful errors.
79
+
By adding the `housingLocation` property of type `HousingLocation` to the `Home` class, we're able to confirm that the data matches the description of the interface. If the data didn't satisfy the description of the interface, the IDE has enough information to give us helpful errors.
80
80
81
-
1. Save your changes and confirm the app does not have any errors. Open the browser and confirm that your application still displays the message "housing-location works!"
81
+
1.Save your changes and confirm the app does not have any errors. Open the browser and confirm that your application still displays the message "housing-location works!"
82
82
83
-
<imgalt="browser frame of homes-app displaying logo, filter text input box and search button and the message 'housing-location works!'"src="assets/images/tutorials/first-app/homes-app-lesson-03-step-2.png">
83
+
<imgalt="browser frame of homes-app displaying logo, filter text input box and search button and the message 'housing-location works!'"src="assets/images/tutorials/first-app/homes-app-lesson-03-step-2.png">
84
84
85
-
1. Correct any errors before you continue to the next step.
86
-
</docs-step>
85
+
1.Correct any errors before you continue to the next step.
When adding a property binding to a component tag, we use the `[attribute] = "value"` syntax to notify Angular that the assigned value should be treated as a property from the component class and not a string value.
31
+
When adding a property binding to a component tag, we use the `[attribute] = "value"` syntax to notify Angular that the assigned value should be treated as a property from the component class and not a string value.
32
32
33
-
The value on the right-hand side is the name of the property from the `Home`.
33
+
The value on the right-hand side is the name of the property from the `Home`.
34
34
35
-
</docs-step>
35
+
</docs-step>
36
36
37
37
<docs-steptitle="Confirm the code still works">
38
38
1. Save your changes and confirm the app does not have any errors.
Copy file name to clipboardExpand all lines: adev/src/content/tutorials/first-app/steps/07-dynamic-template-values/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ In the code editor:
27
27
1. Navigate to `src/app/housing-location/housing-location.ts`
28
28
1. In the template property of the `@Component` decorator, replace the existing HTML markup with the following code:
29
29
30
-
<docs-codelanguage="angular-ts"header="Update HousingLocation template in housing-location.ts"path="adev/src/content/tutorials/first-app/steps/08-ngFor/src/app/housing-location/housing-location.ts"visibleLines="[6,17]"/>
30
+
<docs-codelanguage="angular-ts"header="Update HousingLocation template in housing-location.ts"path="adev/src/content/tutorials/first-app/steps/08-ngFor/src/app/housing-location/housing-location.ts"visibleLines="[6,17]"/>
31
31
32
32
In this updated template code you have used property binding to bind the `housingLocation.photo` to the `src` attribute. The `alt` attribute uses interpolation to give more context to the alt text of the image.
Copy file name to clipboardExpand all lines: adev/src/content/tutorials/first-app/steps/09-services/README.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,9 +35,9 @@ In the **Terminal** pane of your IDE:
35
35
1. In your project directory, navigate to the `first-app` directory.
36
36
1. In the `first-app` directory, run this command to create the new service.
37
37
38
-
```shell
39
-
ng generate service housing --skip-tests
40
-
```
38
+
```shell
39
+
ng generate service housing --skip-tests
40
+
```
41
41
42
42
1. Run `ng serve` to build the app and serve it to `http://localhost:4200`.
43
43
1. Confirm that the app builds without error.
@@ -63,7 +63,7 @@ In the **Edit** pane of your IDE:
63
63
64
64
1. Add a file level import for the `HousingLocation`.
65
65
66
-
<docs-codeheader="Import HousingLocation type in src/app/housing.service.ts"path="adev/src/content/tutorials/first-app/steps/10-routing/src/app/housing.service.ts"visibleLines="[2]"/>
66
+
<docs-codeheader="Import HousingLocation type in src/app/housing.service.ts"path="adev/src/content/tutorials/first-app/steps/10-routing/src/app/housing.service.ts"visibleLines="[2]"/>
67
67
68
68
1. Confirm that the app builds without error.
69
69
Correct any errors before you continue to the next step.
@@ -75,23 +75,23 @@ In a later lesson, you'll replace the static data with a live data source to get
75
75
76
76
In the **Edit** pane of your IDE, in `src/app/home/home.ts`:
77
77
78
-
1. At the top of `src/app/home/home.ts`, add the `inject` to the items imported from `@angular/core`. This will import the `inject` function into the `Home` class.
78
+
1.At the top of `src/app/home/home.ts`, add the `inject` to the items imported from `@angular/core`. This will import the `inject` function into the `Home` class.
79
79
80
-
<docs-codelanguage="angular-ts"header="Update to src/app/home/home.ts"path="adev/src/content/tutorials/first-app/steps/10-routing/src/app/home/home.ts"visibleLines="[1]"/>
80
+
<docs-codelanguage="angular-ts"header="Update to src/app/home/home.ts"path="adev/src/content/tutorials/first-app/steps/10-routing/src/app/home/home.ts"visibleLines="[1]"/>
81
81
82
-
1. Add a new file level import for the `HousingService`:
82
+
1.Add a new file level import for the `HousingService`:
83
83
84
-
<docs-codelanguage="angular-ts"header="Add import to src/app/home/home.ts"path="adev/src/content/tutorials/first-app/steps/10-routing/src/app/home/home.ts"visibleLines="[4]"/>
84
+
<docs-codelanguage="angular-ts"header="Add import to src/app/home/home.ts"path="adev/src/content/tutorials/first-app/steps/10-routing/src/app/home/home.ts"visibleLines="[4]"/>
85
85
86
-
1. From `Home`, delete the `housingLocationList` array entries and assign `housingLocationList` the value of empty array (`[]`). In a few steps you will update the code to pull the data from the `HousingService`.
86
+
1.From `Home`, delete the `housingLocationList` array entries and assign `housingLocationList` the value of empty array (`[]`). In a few steps you will update the code to pull the data from the `HousingService`.
87
87
88
-
1. In `Home`, add the following code to inject the new service and initialize the data for the app. The `constructor` is the first function that runs when this component is created. The code in the `constructor` will assign the `housingLocationList` the value returned from the call to `getAllHousingLocations`.
88
+
1.In `Home`, add the following code to inject the new service and initialize the data for the app. The `constructor` is the first function that runs when this component is created. The code in the `constructor` will assign the `housingLocationList` the value returned from the call to `getAllHousingLocations`.
89
89
90
-
<docs-codelanguage="angular-ts"header="Initialize data from service in src/app/home/home.ts"path="adev/src/content/tutorials/first-app/steps/10-routing/src/app/home/home.ts"visibleLines="[23,30]"/>
90
+
<docs-codelanguage="angular-ts"header="Initialize data from service in src/app/home/home.ts"path="adev/src/content/tutorials/first-app/steps/10-routing/src/app/home/home.ts"visibleLines="[23,30]"/>
91
91
92
-
1. Save the changes to `src/app/home/home.ts` and confirm your app builds without error.
93
-
Correct any errors before you continue to the next step.
94
-
</docs-step>
92
+
1.Save the changes to `src/app/home/home.ts` and confirm your app builds without error.
93
+
Correct any errors before you continue to the next step.
0 commit comments