How to make template dashboards

sometimes it might be useful to recycle a dashboard ui for different items. So I came up in my specific case of a rollershutter timer ui with the following solution (which I am still working on though, so there is no complete example yet):

  1. call the dashboard with templatedashboardname#itemname (for instance via switch-dashboard)
  2. inside the dashboard wrap the following around each widget, where itemname is required:
<div oc-lazy-load="['getItemFromLocation.js']">
  <div ng-controller="getLocation">
.... widget stuff, get the itemname via {{item}} ...

here one could expand the itemname for instance via {{itemValue(item + ‘_timeup’)}} etc… if items are defined appropriately (rs1, rs1_timeup, …)
3) To make it work, we need getItemFromLocation.js:

(function() {
    'use strict';
        .controller('getItemFromLocation', getItemFromLocation);
    getItemFromLocation.$inject = ['$scope', '$location'];
    function getItemFromLocation($scope, $location) {
		$scope.item = $location.hash();

Hope this is useful for someone!

Thanks Daniel, that is exactly what I was looking for here:
Passing parameters to dashboards - Apps & Services / HABPanel - openHAB Community

Just FYI, to make your snippet work, I had to:
a) Store the file getItemFromLocation.js in the html folder of OpenHab (/etc/openhab/html/), not sure if that’s obvious to everyone.
b) Change controller=“getLocation” to controller=“getItemFromLocation”.
c) Change oc-lazy-load="[‘getItemFromLocation.js’]" to oc-lazy-load="[’/static/getItemFromLocation.js’]"

Maybe you can update your post to reflect these clarifications/fixes.

Thanks again,