'use strict';

angular.module('SecretSantaApp.controllers', [])
  .controller('detailsController', function($scope) {
    $scope.title = '';
    $scope.cashAmount = 0;
    $scope.cashCurrency = 'gbp';
  })
  .controller('namesController', function($scope) {
    $scope.people = [{
      name: 'joris',
      email: 'joris@test.be'
    },
    {
      name: 'seeger',
      email: 'seeger@test.be'
    }];
    $scope.newPerson = {};
  });
  // .controller('namesController', function($scope, $compile) {
  //   $scope.people = [];
  //   $scope.newPerson = {};

  //   $scope.addPerson = function() {
  //     var el;
  //     $scope.people.push($scope.newPerson);
  //     $scope.newPerson = {};
  //     $('.names-container').append(
  //       $compile('<div data-person />')($scope)
  //     );
  //   };
  // });

@@ -126,31 +126,41 @@
 ope.
+event = %7B%0A      
 title
- = '';
+: '',
 %0A    
-$scope.
+  
 cash
@@ -169,46 +169,64 @@
 ount
- = 0;%0A    $scope.cashCurrency = 'gbp';
+: 15,%0A      cashCurrency: 'eur',%0A      message: ''%0A    %7D
 %0A  %7D
@@ -304,235 +304,84 @@
  = %5B
-%7B%0A      name: 'joris',%0A      email: 'joris@test.be'%0A    %7D,%0A    %7B%0A      name: 'seeger',%0A      email: 'seeger@test.be'%0A    %7D%5D;%0A    $scope.newPerson = %7B%7D;%0A  %7D);%0A  // .controller('namesController', function($scope, $compile
+%5D;%0A    $scope.newPerson = %7B%7D;%0A%0A    $scope.addPerson = function(person
 ) %7B%0A  
-//
+ 
    $
@@ -396,19 +396,26 @@
 ople
- = %5B%5D
+.push(person)
 ;%0A  
-//
+ 
    $
@@ -436,21 +436,25 @@
 n = %7B%7D;%0A
-%0A
   
-//
+  %7D;%0A%0A 
    $scop
@@ -447,35 +447,38 @@
  %7D;%0A%0A    $scope.
-add
+remove
 Person = functio
@@ -483,16 +483,19 @@
 ion(
+person
 ) %7B%0A 
- //
     
@@ -503,20 +503,15 @@
 var 
-el;%0A  //    
+index =
  $sc
@@ -525,24 +525,17 @@
 ple.
-push($scope.newP
+indexOf(p
 erso
@@ -544,154 +544,124 @@
 ;%0A  
-//
     
- $scope.newPerson = %7B%7D;%0A  //
+if (index %3E -1) %7B%0A   
      $
-('.names-container').append(%0A  //       $compile('%3Cdiv data-person /%3E')($scope)%0A  //
+scope.people = $scope.people.splice(index, 1);%0A        person = null;%0A 
      
-);
+%7D
 %0A 
- //
    %7D
-;
 %0A 
- //
  %7D);

fix namescontroller