Parent: [633ad7] (diff)

Download this file

createAppCtrl.js    52 lines (47 with data), 1.3 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
/*made by Miguel Rodrigues @ KBZ miguel.rodrigues@knowledgebiz.pt*/
console.log("Defining createAppCtrl");
angular.module('mainApp')
.controller('createAppCtrl', function($scope, $routeParams, $http, appService, $timeout) {
$scope.show = false;
$scope.showError = false;
$scope.appID = null;
$scope.developerid = $routeParams.developerid;
$scope.successappID = 0;
console.log("Running createAppCtrl... ");
$scope.postdata = function (appID) {
$scope.successappID = 0;
if(appID == null){
$scope.successappID = 2;
}else{
$scope.successappID = 1;
var data = {
appID:[
appID
],
developerID:[
$routeParams.developerid
]
};
appService.postApp(data).then(function(response) {
if(response.data.success){
console.log("Post Data Submitted Successfully!");
$scope.notifytitle = "Success to create vApp";
$scope.show = true;
$timeout(function() {
$scope.show = false;
window.location = "/"+$routeParams.developerid;
}, 2000)
}
},function(err){
$scope.showError = true;
$timeout(function() {
$scope.showError = false;
}, 2000)
});
}
};
$scope.redirectAppManager = function () {
window.location = '/'+$routeParams.developerid
};
console.log("Loading createAppCtrl");
});