Parent: [d16a51] (diff)

Child: [633ad7] (diff)

Download this file

createAppCtrl.js    44 lines (40 with data), 1.2 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
/*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("$routeParams.developerid: " + $routeParams.developerid);
$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)
});
}
};
console.log("Loading createAppCtrl");
});