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: docs/01-components-and-layout.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,7 +55,7 @@ To get the available list of specials we need to call an API on the backend. Bla
55
55
@inject HttpClient HttpClient
56
56
```
57
57
58
-
The `@inject` directive essentially defines a new property on the component where the first token specified the property type and the second token specifies the property name. The property is populated for you using dependency injection.
58
+
The `@inject` directive essentially defines a new property on the component where the first token specifies the property type and the second token specifies the property name. The property is populated for you using dependency injection.
59
59
60
60
Override the `OnInitializedAsync` method in the `@code` block to retrieve the list of pizza specials. This method is part of the component lifecycle and is called when the component is initialized. Use the `GetFromJsonAsync<T>()` method to handle deserializing the response JSON:
61
61
@@ -94,14 +94,14 @@ Once the component is initialized it will render its markup. Replace the markup
94
94
</div>
95
95
```
96
96
97
-
Run the app by hitting `Ctrl-F5`. Now you should see a list of the specials available.
97
+
Run the app by hitting `Ctrl-F5`. Now you should see a list of the specials that are available.
Layouts in Blazor are also components. They inherit from `LayoutComponentBase`, which defines a `Body` property that can be used to specify where the body of the layout should be rendered. The layout component for our pizza store app is defined in *Shared/MainLayout.razor*.
107
107
@@ -113,9 +113,9 @@ Layouts in Blazor are also components. They inherit from `LayoutComponentBase`,
113
113
</div>
114
114
```
115
115
116
-
To see how the layout is associated with your pages, look at the `<Router>` component in `App.razor`. Notice the `DefaultLayout` parameter which determines the layout used for any page that doesn't specify its own layout directly.
116
+
To see how the layout is associated with your pages, look at the `<Router>` component in `App.razor`. Notice that the `DefaultLayout` parameter determines the layout used for any page that doesn't specify its own layout directly.
117
117
118
-
You can also override this `DefaultLayout` on a per-page basis. To do so, you can add directive such as `@layout SomeOtherLayout` at the top of any `.razor` page component. However, you don't need to do so in this application.
118
+
You can also override this `DefaultLayout` on a per-page basis. To do so, you can add a directive such as `@layout SomeOtherLayout` at the top of any `.razor` page component. However, you will not need to do so in this application.
119
119
120
120
Update the `MainLayout` component to define a top bar with a branding logo and a nav link for the home page:
121
121
@@ -136,11 +136,11 @@ Update the `MainLayout` component to define a top bar with a branding logo and a
136
136
</div>
137
137
```
138
138
139
-
The `NavLink` component is provided by Blazor. Components can be used from components, which is done by specifying an element with the component's type name along with attributes for any component parameters.
139
+
The `NavLink` component is provided by Blazor. Components can be used from components by specifying an element with the component's type name along with attributes for any component parameters.
140
140
141
141
The `NavLink` component is the same as an anchor tag, except that it adds an `active` class if the current URL matches the link address. `NavLinkMatch.All` means that the link should be active only when it matches the entire current URL (not just a prefix). We'll examine the `NavLink` component in more detail in a later session.
142
142
143
-
Run the app by hitting `Ctrl-F5`. With our new layout our pizza store app now looks like this:
143
+
Run the app by hitting `Ctrl-F5`. With our new layout, our pizza store app now looks like this:
0 commit comments