-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
36 lines (33 loc) · 947 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
var app = angular.module('data', [])
app.controller('sub', ['$scope', '$http', function ($scope, $http) {
$scope.school = {};
$scope.subjects = [{
'name' : '',
'teacher_id' : '',
'teacher_name' : '',
'subject_code' : '',
'subject_type' : ''
}]
$scope.add_more_subs = function () {
$scope.subjects.push({})
}
$scope.submit = function () {
$scope.final_data = {
'school_data' : $scope.school,
'subject_data' : $scope.subjects
}
console.log($scope.$school);
console.log($scope.final_data);
$http({
method : 'POST',
headers : {'Content-Type': 'application/x-www-form-urlencoded'} ,
data : $scope.school,
url : "https://api.staticman.net/v2/entry/SDC-USICT/data-portal/master/comments"
}).then(function mySucces(response) {
console.log('sucess')
console.log(response);
}, function myError(response) {
console.log(response)
});
}
}])