我有一个看起来像这样的表格
<form action="" method="post" class="form form--login">
<div class="form__field">
<label class="fontawesome-user" for="login__firstname"><span class="hidden">Name</span></label>
<input id="login__firstname" ng-model="emailInvite.forename" typ
e="text" class="form__input" placeholder="Name" required>
</div>
<div class="form__field">
<label class="fontawesome-user" for="login__surname"><span class="hidden">Surname</span></label>
<input id="login__surname" ng-model="emailInvite.surname" type="text" class="form__input" placeholder="Surname" required>
</div>
<div class="form__field">
<label class="fontawesome-envelope" for="login__email"><span class="hidden">Email</span></label>
<input id="login__email" ng-model="emailInvite.email" type="text" class="form__input" placeholder="Email" required>
</div>
<div class="form-group">
<p>Upload Emails here </p>
<input type="file" id="exampleInputFile">
<p class="help-block">Using .csv to upload</p>
</div>
<div class="form__field">
<input type="button" class="btn btn-info" ng-click="saveInvites()" value="Save Email">
</div>
</form>
目前它填充了一个数据库和一个列表,我想这样做,以便列表不填充是两次输入相同的detials。例如同样的电子邮件。
继承我的控制器表格
$scope.emailInvite = {
forename: '',
surname: '',
email: ''
};
$scope.saveInvites = function (){
var emailDetails = {
forename: $scope.emailInvite.forename,
surname: $scope.emailInvite.surname,
email: $scope.emailInvite.email,
event_id: $scope.eventId
}
$scope.emailInvites.push(emailDetails);
var res = $http.post('/delegates.json', emailDetails);
res.success(function (data, status, headers, config) {
// $state.go('event.payments');
bootbox.alert("Saved email details");
});
res.error(function (data, status, headers, config) {
//TODO proper error needs fixes on server
bootbox.alert("Email not saved: " + JSON.stringify({data: data}));
});
};
});