var app=angular.module('projectAngular',[]);

app.controller('ProjectController',function($scope,$http){

	$scope.counter = 3;
	 $scope.positions = []
	$scope.addProject = function(position){
		console.log($scope.project_name);
		var insertPos = [];
		insertPos.push({"skill1" : $scope.pos1});
		insertPos.push({"skill2" : $scope.pos2});
		insertPos.push({"skill3" : $scope.pos3});
		var c = 4;
		var length = $scope.positions.length;
		for(var i = 0;i<length;i++){
			var l = c + i
			var pos = "skill"+l;
			//var des = "des"+l;
			insertPos.push({pos : position[i].pos});
		}
		console.log("Length--"+insertPos.length);

		$http({

            method:"POST",
            url:'/doAddProject',
            data : {
                "PROJECT_TITLE":$scope.project_name,
                "PROJECT_DESC":$scope.description,
                "POSITIONS" : insertPos
            }


        }).then(function(res){
        	console.log(res);
        	if(res.data.statusCode == 200){

        		console.log("Project Added!!!");
        	}
        }, function(res) { //this will be called on error
          console.log(res.data);
        });
	}

	$scope.addPosition = function(positions){
			$scope.counter++;
			$scope.positions.push({ "count": $scope.counter , skill: '',des:''});
	            
	 };
	 $scope.count = 0;
	 $scope.projectList = function(){
	 	
	 	$http({

            method:"POST",
            url:'/getProjectList',
            data : {
               
            }


        }).then(function(res){
        	console.log(res.data.result);
        	$scope.projects = res.data.result;
        	
        }, function(res) { //this will be called on error
          console.log(res.data);
        });
	 }
	 $scope.projectList();
});

@@ -243,16 +243,78 @@
 s = %5B%5D;%0A
+%09%09console.log(%22---%3E%22+$scope.pos3);%0A%09%09if($scope.pos1!=null)%7B%0A%0A%09
 %09%09insert
@@ -329,17 +329,16 @@
 (%7B%22skill
-1
 %22 : $sco
@@ -344,24 +344,55 @@
 ope.pos1%7D);%0A
+%09%09%7D%0A%09%09if($scope.pos2!=null)%7B%0A%0A%09
 %09%09insertPos.
@@ -403,17 +403,16 @@
 (%7B%22skill
-2
 %22 : $sco
@@ -422,16 +422,84 @@
 pos2%7D);%0A
+%09%09%7D%0A%09%09if($scope.pos3!=null)%7B%0A%09%09%09console.log(%22skill 3 not defined%22)%0A%09
 %09%09insert
@@ -514,17 +514,16 @@
 (%7B%22skill
-3
 %22 : $sco
@@ -533,16 +533,20 @@
 pos3%7D);%0A
+%09%09%7D%0A
 %09%09var c 
@@ -734,16 +734,16 @@
 %7D);%0A%09%09%7D%0A
+
 %09%09consol
@@ -768,23 +768,16 @@
 nsertPos
-.length
 );%0A%0A%09%09$h

Add project updated