lisaa_jasen.html button, post_member.js changed idea to angular js

This commit is contained in:
HooVee
2016-07-20 21:35:03 +03:00
parent 4906909cd1
commit 42b13f6470
4 changed files with 41 additions and 11 deletions
+10 -2
View File
@@ -1,4 +1,10 @@
<table id="choose-address-table" class="ui-widget ui-widget-content">
<h1> Lisää jäsen </h1>
<script src="../js/post_member.js"></script>
<div ng-app="getApp" ng-controller="getController">
<table id="choose-address-table" class="ui-widget ui-widget-content">
<thead>
<tr class="ui-widget-header ">
<th>Etunimi</th>
@@ -32,4 +38,6 @@
</td>
</tr>
</tbody>
</table>
</table>
</div>
+7 -7
View File
@@ -8,29 +8,29 @@
<form name="memberForm" ng-submit="submitForm()">
<div class="form-group">
<label>Etunimi: </label>
<input id="firstNameField" required type="text" placeholder="Sähkö" class="form-control" ng-model="member.first_name"><br>
<input id="firstNameField" required type="text" placeholder="Sähkö" class="form-control" ng-model="firstName"></input>
</div>
<div class="form-group">
<label>Sukunimi: </label>
<input id="lastNameField" required type="text" placeholder="Insinööri" class="form-control" ng-model="member.last_name"><br>
<input id="lastNameField" required type="text" placeholder="Insinööri" class="form-control" ng-model="lastName"></input>
</div>
<div class="form-group">
<label>Sähköposti: </label>
<input id="emailField" required type="text" placeholder="sahko.insinoori@aalto.fi" class="form-control" ng-model="member.email"><br>
<input id="emailField" required type="text" placeholder="sahko.insinoori@aalto.fi" class="form-control" ng-model="email"></input>
</div>
<div class="form-group">
<label>AYY jäsen: </label>
<input type="checkbox" id="AYY" value="1" ng-model="member.AYY"><br>
<input type="checkbox" id="AYY" value="0" ng-model="AYY"></input>
</div>
<div class="form-group">
<label>JAS-listaan: </label>
<input type="checkbox" id="JAS" value="1" ng-model="member.JAS"><br>
<input type="checkbox" id="JAS" value="0" ng-model="JAS"></input>
</div>
<div class="form-group">
<label>Asuinkunta: </label>
<input id="PORField" required type="text" placeholder="Otaniemi" class="form-control" ng-model="member.POR"><br>
<input id="PORField" required type="text" placeholder="Otaniemi" class="form-control" ng-model="POR"></input>
</div>
<input type="submit" id="sendmember" onclick="post_member" value="Lähetä">
<button ng-click="send()" type="submit" id="sendmember">Tallenna</button>
</form>
</div>
+24 -1
View File
@@ -5,6 +5,29 @@ var ayy = document.getElementById('AYY').value;
var jas = document.getElementById('JAS').value;
var porField = document.getElementById('PORField').value;
*/
function postMember(data){
//post json dada to server
//url /members/api/member
}
var app = angular.module("sendMember", []);
app.controller("postController", function($scope) {
$scope.firstName = "";
$scope.lastName = "";
$scope.email = "";
$scope.AYY = "";
$scope.JAS = "";
$scope.POR = "";
$scope.send = function() {
postMember({"first_name":$scope.firstName, "last_name":$scope.lastName, "email":$scope.email, "AYY":$scope.AYY, "jas":$scope.JAS, "POR":$scope.POR});
});
}
/*
var subButton = document.getElementById('sendmember');
$(subButton).click(function(){
@@ -22,4 +45,4 @@ $(subButton).click(function(){
alert("Data: " + data + "\nStatus: " + status);
});
});
*/
-1
View File
@@ -1,4 +1,3 @@
//ReactDOM.render(<h1>Hello World</h1>, document.getElementById("react-test"));
/*
var CommentBox = React.createClass
({