documentation

angular
Matt Huntington 10 years ago
parent 4d073df1eb
commit cd06597fdd

@ -64,7 +64,9 @@ app.controller('TransgressionsController', ['$http', function($http){
});
}
// create a confession for a transgression identified by transgression_id
this.createConfession = function(transgression_id){
//AJAX call using parameter that identifies transgression
$http.post('/transgressions/'+transgression_id+'/confessions', {
//include authenticity_token
authenticity_token: authenticity_token,
@ -73,6 +75,7 @@ app.controller('TransgressionsController', ['$http', function($http){
occurred_at: this.newConfessionDate
}
}).success(function(data){
//refresh transgression data once POST is complete
getTransgressions();
});
}

@ -17,6 +17,7 @@
When: {{confession.occurred_at}}
</li>
</ul>
<!-- Confessions go are displayed/created -->
<h3>Add a confession (yum):</h3>
<form ng-submit="transgressionsCtrl.createConfession(transgression.id)">
<input type="text" ng-model="transgressionsCtrl.newConfessionDescription" placeholder="How did you please me?"/>

Loading…
Cancel
Save