Disentangling "get links" mechanism from $scope.
Simplifying constructURL.
Moving the controller's node-expansion logic into a separate function, for clarity.