Skip to content

Commit

Permalink
docs(steps/30/README.md): Adjust section about router instance determ…
Browse files Browse the repository at this point in the history
…ination

Fixes #81
  • Loading branch information
flovogt committed Nov 25, 2024
1 parent f21428a commit f84f673
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions steps/30/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ We thus have everything we need to define a routing from the starting view to th
We add a new “routing" section to the `sap.ui5` part of the descriptor. There are three subsections that define the routing and navigation structure of the app:

- `config`
This section contains the global router configuration and default values that apply for all routes and targets. The property routerClass is special as it determines the router implementation. The default value is `sap.ui.core.routing.Router`. Here, we set the `routerClass` to s`ap.m.routing.Router`, because our app is based on `sap.m`. All other properties in config are given to the router instance. For example, we define in `path` where our views are located in the app. As we want to specify view to view navigation and we only use XML views in our app we preset also the paramter `type` and `viewType`. To load and display views automatically, we also specify the `controlId` of the control that will contain the views and the aggregation (`controlAggregation`) of the control where the views will be added. Here we specify that the views are loaded into the `pages` aggregation of the control with the id we provided in the app view.
This section contains the global router configuration and default values that apply for all routes and targets. The property routerClass is special as it determines the router implementation. The default value is `sap.ui.core.routing.Router`. Here, we set the `routerClass` to `sap.m.routing.Router`, because our app is based on `sap.m`. All other properties in config are given to the router instance. For example, we define in `path` where our views are located in the app. As we want to specify view to view navigation and we only use XML views in our app we preset also the paramter `type` and `viewType`. To load and display views automatically, we also specify the `controlId` of the control that will contain the views and the aggregation (`controlAggregation`) of the control where the views will be added. Here we specify that the views are loaded into the `pages` aggregation of the control with the id we provided in the app view.

> 📌 **Important:**
> The possible values for `routerClass` are `sap.ui.core.routing.Router`, `sap.m.routing.Router`, or any other subclasses of `sap.ui.core.routing.Router`. Compared to `sap.ui.core.routing.Router` the `sap.m.routing.Router` is optimized for mobile apps and adds the properties `level`, `transition` and `transitionParameters` which can be specified for each route or target created by the `sap.m.routing.Router`.
Expand Down Expand Up @@ -223,7 +223,7 @@ Initializing the router will evaluate the current URL and load the corresponding

### webapp/controller/InvoiceList.controller.ts

What is still missing is the event handler that performs a navigation to the detail page by clicking an item in the invoice list: To access the router instance for our app we first need to cast `this.getOwnerComponent()`to our component, then we can call the helper method `getRouter()`. On the router we call the `navTo` method passing the pattern name we defined in our app descriptor for routing to the details page.
What is still missing is the event handler that performs a navigation to the detail page by clicking an item in the invoice list: To access the router instance for our app use the static method `getRouterFor()` on the `UIComponent` module. On the router we call the `navTo` method passing the pattern name we defined in our app descriptor for routing to the details page.

```ts
import Controller from "sap/ui/core/mvc/Controller";
Expand Down

0 comments on commit f84f673

Please sign in to comment.