I need to build a navigation with a dynamic route parameter from controller.
//user.controller.js
(function () {
sap.ui.controller("app.User", {
getNavUrl: function (tab) {
return '#/users/+ this.userId + '/' + tab;
}
});
}());
//user.view.html
<div data-sap-ui-type="ui5strap.Nav" data-selection-mode="Single">
<div data-sap-ui-type="ui5strap.ListNavItem"
data-selected="true"
data-text="{i18n>Grants}"
data-href={getNavUrl('grants')}> <!-- cant make this to work! -->
</div>
<div data-sap-ui-type="ui5strap.ListNavItem"
data-text="{i18n>Opportunities}"
data-href={getNavUrl('opportunities')}> <!-- cant make this to work! -->
</div>
</div>
So, the way i'd do this in any MVC - is by passing a string to controller method from within view, but i can't seem to find a way to invoke controller method from view in sapui5.