-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
64 lines (53 loc) · 1.24 KB
/
app.js
File metadata and controls
64 lines (53 loc) · 1.24 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
(function(){
'use strict';
angular.module("dmathAPP",[])
.controller('propositionLogic',propositionLogic)
.service('requestService', requestService)
.constant('baseURL','https://188.131.137.105:8085/');
propositionLogic.$inject = ['requestService']
function propositionLogic(requestService){
var pl = this;
pl.formulaStr = "";
pl.submit = function(){
var promise = requestService.getTF(pl.formulaStr);
promise.then(function(response){
pl.errorMsg = "";
pl.TF = response.data;
pl.heads = [];
pl.row = [];
for(var colName in pl.TF){
if(colName!=="output")
pl.heads.push(colName);
}
pl.heads.push('output');
for(var idx in pl.TF.output){
var dct = {};
for(var colName in pl.TF) {
dct[colName] = pl.TF[colName][idx];
}
pl.row.push(dct);
}
// console.log(pl.heads);
// console.log(pl.row);
console.log(pl.TF);
}).catch(function(error){
pl.errorMsg = error;
console.log(error);
});
};
}
requestService.$inject = ['$http','baseURL']
function requestService($http,baseURL){
var service = this;
service.getTF = function(formulaStr) {
var response = $http({
method: "GET",
url: baseURL,
params: {
"formula": formulaStr
}
});
return response;
};
}
})();