     confirmationDialog
       message: "Deleting #{collection.name}. Are you sure?"
       onOk: ->
-        url = "/databases/#{$scope.dbName}/collections/#{collection.name}"
+        url = "/databases/#{dbName}/collections/#{collection.name}"
         doAction(url, "delete")
 
 @DocumentsCtrl = ($scope, $element, confirmationDialog, doAction) ->
-  $scope.dbName = $element.data("db-name")
-  $scope.collectionName = $element.data("collection-name")
+  dbName = $element.data("db-name")
+  collectionName = $element.data("collection-name")
 
   $scope.delete = (id) ->
     confirmationDialog
       message: "Are you sure?"
       onOk: ->
-        url = "/databases/#{$scope.dbName}/collections/#{$scope.collectionName}/#{id}"
+        url = "/databases/#{dbName}/collections/#{collectionName}/#{id}"
         doAction(url, "delete")

        doAction(url, "delete")

@CollectionsCtrl = ($scope, $element, tableFilterFactory, confirmationDialog, doAction) ->
  $scope.dbName = $element.data("db-name")
  $scope.collections = $element.data("collections")
  $scope.tableFilter = tableFilterFactory($scope, "collections")


@DatabasesCtrl = ($scope, $element, tableFilterFactory, confirmationDialog, doAction) ->
  $scope.databases = $element.data("databases")
  $scope.tableFilter = tableFilterFactory($scope, "databases")

