Kinda new to angularjs. I have the following code and just wondering if someone can't enlighten me as to why my values aren't being persisted in there respective array
<script type="text/javascript">
'use strict';
var app = angular.module('app', ['appControllers']);
"use strict";
var appControllers = angular.module('app', []);
appControllers.controller('personController', ['$scope', '$http', function ($scope, $http) {
$scope.responses = [];
$scope.coaches = [];
$scope.athletes = [];
$scope.staff = [];
$scope.addCoach = function() {
var coach = $scope.coach;
$scope.coach = {}; // Do this to clean up the form fields
$scope.coaches.push(coach);
//$scope.responses.push(coaches);
};
.....
$scope.addContact = function ($event) {
$event.preventDefault();
$scope.responses.push(coaches);
console.log("inside this method");
}
So i take the list of coaches that have been added and am trying to push them further to the responses array. Everytime is hits this function of addContact or just pushing it from the original function it returns the responses array as empty. any insight?