'use strict' angular.module('EXAM').controller('AnswerSingleChoice', ['$scope', '$http', function($scope, $http){ $scope.question = new Question() $scope.addSingleChoice = function(obj){ $scope.question.addSingleChoice(obj, Math.max.apply(Math, obj.map(function(result){ return result.id }))) } $scope.deleteArray = function(obj, index){ $scope.question.deleteArray(obj, index) } }])