After routing configuration, we will now take a look at how to use the router with the configured routes.
Implementing the Carrier View
The starting point of our full-screen application is the Carrier view.
In this video lets take a look at how to implement this carrier view:
The sap.m.Page holds an aggregation with the name content. The content aggregation is of type, sap.ui.core.Control. In the sample shown above, an sap.m.Table control (1) is added to the content aggregation. The table is bound to an entity, CarrierCollection. For each entity of the collection, an object of type ColumnListItem (2) is created and added to the table.
Implementing the Flights Detail View
The Flights view displays master data for a flight sap.m.ObjectHeader control. The data comes from a relative data binding that is set on the view level as we have seen in the controller before.

The Flights view implementation shows the details of the selected carrier and the list of flights for the selected carrier in a table. To provide the functionality for navigating back to the carrier view, we add the property showNavButton with the value, true, to the page object.
To handle the back navigation, we assign an event handler for the navButtonPress event (1). The event handler is implemented inside the flights controller.
Implementation of the Back Button on the Flights Page
To enable the back navigation from the Flights view to the Carrier view, we have to add a corresponding event handler.

- Implement a function that returns the router instance for your component. It is also possible to use this.getOwnerComponent().getRouter().
- Implement the event handler function onNavBack.
This functions checks if there is a previous hash value in the app history, if so, redirect to the previous hash via the browser’s native History API. If not, use the Router to navigate to the route overview which is the carriers overview view.
The function navTo of the router is invoked using the name of the route and a boolean parameter indicating if a browser history entry should be created.
- true: the hash is replaced (no browser history entry)
- false: the hash is set (browser history entry)
Display the NotFound Page for Invalid Carrier ID
As introduced in previous lessons, we have to make sure that the application is able to handle invalid hashes. To react to invalid hashes, we have to extend the element binding in the Flights.controller.js.

- To react on the change event of the binding operation you can attach an event handler. You can display targets manually without referencing them in a navigation route. Good examples for this are temporary errors, switching to an edit page for a business object, or going to a "Settings" page.
- Inside the _onBindingChange() handler we get a reference to the Targets helper object of the router and simply call display("notFound").
The view associated to the target with the name notFound from the routing configuration will be displayed by the router without changing the hash.
The sap.m.routing.Targets object is retrieved by calling getTargets() on the router. However, you could also get a reference to the sap.m.routing.Targets object by calling this.getOwnerComponent().getRouter().getTargets() or this.getOwnerComponent().getTargets().






