From 0436b099d00d251a86017d617771c70b0eb99235 Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Sun, 21 Dec 2014 21:45:44 -0500 Subject: [PATCH] Use monitor save function from Factory, not controller --- web/skins/bootstrap/js/controllers.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/web/skins/bootstrap/js/controllers.js b/web/skins/bootstrap/js/controllers.js index 1cab72fb6..e52170fae 100644 --- a/web/skins/bootstrap/js/controllers.js +++ b/web/skins/bootstrap/js/controllers.js @@ -98,16 +98,9 @@ ZoneMinder.controller('MonitorController', function($scope, $http, $location, Mo // Call Monitor.saveMonitor when the save button is clicked. Pass along $scope.monitor $scope.submitMonitor = function() { - $http({ - method : 'POST', - url : '/api/monitors.json', - data : $.param($scope.monitor), - headers : { 'Content-Type': 'application/x-www-form-urlencoded' } // set the headers so angular passing info as form data (not request payload) - }) - .success(function(data) { - console.log(data); - window.location = "/index.php?view=console"; - }); + Monitor.saveMonitor($scope.monitor) + // Redirect to the dashboard on success + .success(function(data) { window.location = "/index.php?view=console"; }); }; });