programmatically creating select

api
Matt Huntington 10 years ago
parent 1d4392e99a
commit 30fa83d002

@ -13,6 +13,8 @@ app.controller('TransgressionsController', ['$http', function($http){
controller.transgressions = data.transgressions; controller.transgressions = data.transgressions;
}); });
this.SIN_TYPES = [ 'Gluttony', 'Greed', 'Anger', 'Pride', 'Lust', 'Sloth', 'Envy'];
this.createTransgression = function(){ this.createTransgression = function(){
var csrf = document.querySelector('meta[name="csrf-token"]').getAttribute('content'); var csrf = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
$http.post('/transgressions', { $http.post('/transgressions', {

@ -21,10 +21,14 @@
</ul> </ul>
<h2>The Flesh is Weak</h2> <h2>The Flesh is Weak</h2>
<form ng-submit="transgressionsCtrl.createTransgression()"> <form ng-submit="transgressionsCtrl.createTransgression()">
<input Your Weakness:
type="text" <select ng-model="transgressionsCtrl.newTransgressionSinType">
ng-model="transgressionsCtrl.newTransgressionSinType" <option
placeholder="How have you pleased me?" /> value="{{SIN_TYPE}}"
ng-repeat="SIN_TYPE in transgressionsCtrl.SIN_TYPES track by $index">
{{SIN_TYPE}}
</option>
</select>
<br/> <br/>
<textarea <textarea
ng-model="transgressionsCtrl.newTransgressionDescription" ng-model="transgressionsCtrl.newTransgressionDescription"

Loading…
Cancel
Save