Link Search Menu Expand Document

Titles in Targets

Routing in SAPUI5 allows you to define titles declaratively in the configuration. The title can be set with valid binding syntax which is then resolved under the scope of the target to which it belongs. This means that the title can be translated when it’s bound to the i18n model or resolved dynamically under the current binding context (1).

Using a translated Target Title

{
    ...,
    "routes": [{
        "pattern": "products/overview",
        "name": "ProductsOverview",
        "target": "products"
    }],
    "targets": {
        "products": {
            "type": "View",
            "path": "shop.products",
            "title": "{i18n>products.overview}"

        }
    },
    ...
}

Using a bound Target Title dynamically

{
    ...,
    "routes": [{
        "pattern": "products/{id}",
        "name": "Product",
        "target": "product"
    }],
    "targets": {
        "product": {
            "type": "View",
            "path": "shop.products",
            "title": "{ 
                parts: ['helperModel>/PRODUCTS_TITLE', 'myModel>productName'], 
                formatter: '.myFormatterFunction' 
            }"
        }
    },
    ...
}

References

(1) UI5 Doc: Using the title Property in Targets