           console.log "Failed to create waterpoint", waterpoint
           for field, message of waterpoint._issues
             flash.error = "#{field}: #{message}"
+
   .controller 'WaterpointEditCtrl', ($scope, $http, $routeParams, Waterpoint, FacilityForm, flash) ->
     Waterpoint.get id: $routeParams.id, (waterpoint) ->
       $scope.form = waterpoint

'use strict'

angular.module('taarifaWaterpointsApp')
  .controller 'NavCtrl', ($scope, $location) ->
    $scope.location = $location
  .controller 'MainCtrl', ($scope, Waterpoint) ->
    Waterpoint.query (waterpoints) ->
      $scope.waterpoints = waterpoints._items
  .controller 'MapCtrl', ($scope, Map) ->
    $scope.map = Map
  .controller 'WaterpointCreateCtrl', ($scope, Waterpoint, FacilityForm, flash) ->
    $scope.formTemplate = FacilityForm 'wpf001'
    # FIXME: Should not hardcode the facility code here

          if status == 200 and data._status == 'ERR'
            for field, message of data._issues
              flash.error = "#{field}: #{message}"

  .controller 'RequestCreateCtrl', ($scope, $location, Request, RequestForm, flash) ->
    $scope.formTemplate = RequestForm 'wps001', $location.search()
    # FIXME: Should not hardcode the service code here
