The following code is part of the template file which constructs this variable URL:

<tr ng-repeat="(id, building) in buildings">
<td>
<a href="#/buildings/{{id}}">{{building.buildingNumber}}</a>
</td>
<td>{{building.buildingName}}</td>
</tr>

(dunebook\three-way-binding\building\buildings.tpl.html)

When showing the buildings using ng-repeat, we pass {{id}} to href to construct the dynamic URL. The service is pretty straightforward:

app.factory("buildingSvc", ['FIREBASE_URI', '$firebaseArray', '$firebaseObject',
  function(FIREBASE_URI, $firebaseArray, $firebaseObject) {
    var buildingsUri = FIREBASE_URI + '/buildings';
    var buildingsRef = new Firebase(buildingsUri);
    var buildings = $firebaseArray(buildingsRef);

    var getBuildings = function () {
      return buildings;
    };

    var getBuilding = function (index) {
      var key = buildings.$keyAt(index);
      var buildingRef = buildingsRef.child(key);
      return $firebaseObject(buildingRef);
    };

    return {
      getBuildings: getBuildings,
      getBuilding: getBuilding
    }
}]);
(dunebook\three-way-binding\building\buildings.svc.js)