           task: $scope.task
           baseTypes: $scope.baseTypes
           relation: relation
+    .result.then () ->
+      init()
 
   deleteFromArray = (item, array) ->
     index = array.indexOf item

          $scope.$parent.alert("An error occured.", "danger")
      )

  return

  $scope.relationTypes = []
  $scope.relationTypesLoading = true

  init = () ->
    $http.get(SERVER_URL + "/base_types").then(
      (response) ->
        $scope.baseTypes = response.data

        $http.get(SERVER_URL + "/tasks/#{$scope.task}/entity_types").then(
          (response) ->
            $scope.entityTypes = response.data
            $scope.entityTypesLoading = false
          (error) ->
            $scope.$parent.alert("An error occured while fetching the entity types.", "danger")
            $scope.entityTypesLoading = false
        )

        $http.get(SERVER_URL + "/tasks/#{$scope.task}/relation_types").then(
          (response) ->
            $scope.relationTypes = response.data
            $scope.relationTypesLoading = false
          (error) ->
            $scope.$parent.alert("An error occured while fetching the relation types.", "danger")
            $scope.relationTypesLoading = false
        )
      (error) ->
        $scope.$parent.alert("An error occured while fetching the base types.", "danger")
    )

  $scope.editType = (type) ->
    $uibModal.open
