0

Is it possible to use a URL parameter as a property binding in UI5?

My problem is that I want to have different OData collections placed in the same UI5 aggregation. For example let's say I've "/Car("Mustang")/parts" and "/Car("Whatever")/parts". Both of them can be placed in the same view.

The application's URL contains the keyword like http://something/#/carMustang. This URL is coming from a routing pattern like "car{carHandle}".

How am I supposed to do stuff like this:

<List items="{/Car({carHandle})/parts}">
 <StandardListItem title={someProperty}>
 </StandardListItem>
</List>

So what would be the best practice to do this? I would like to avoid nasty fiddles in the controller.

OddDev
  • 3,644
  • 5
  • 30
  • 53

1 Answers1

1

In your view:

<List id="parts" items="{parts}">
   <StandardListItem title="{someProperty}"/>
</List>

In your controller code which reacts on matched routes:

var carHandle = event.getParameter("carHandle");
this.byId("parts").bindObject("/Car/" + carHandle);
matbtt
  • 4,230
  • 19
  • 26