From 96493e8df4602bc3e3f6f16381cc257b8ba5aa1f Mon Sep 17 00:00:00 2001 From: Matt Huntington Date: Tue, 3 Nov 2015 11:43:18 -0500 Subject: [PATCH] creating getTransgressions function for use later in adding transgression --- app/assets/javascripts/angular.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/angular.js b/app/assets/javascripts/angular.js index a4331f6..5c7a067 100644 --- a/app/assets/javascripts/angular.js +++ b/app/assets/javascripts/angular.js @@ -17,11 +17,14 @@ app.controller('TransgressionsController', ['$http', function($http){ var authenticity_token = document.querySelector('meta[name="csrf-token"]').getAttribute('content'); var controller = this; - // get transgressions for current User - $http.get('/transgressions').success(function(data){ - //just add the transgressions to the controller, data comes back with sinner as well - controller.current_user_transgressions = data.transgressions; - }); + var getTransgressions = function(){ + // get transgressions for current User + $http.get('/transgressions').success(function(data){ + //just add the transgressions to the controller, data comes back with sinner as well + controller.current_user_transgressions = data.transgressions; + }); + } + getTransgressions(); // create a transgression this.createTransgression = function(){