删除angularjs中的功能

时间:2017-05-02 21:41:03

标签: javascript angularjs spring-boot



               <div class="panel-heading ">Liste des Garanties Marché 
                                            <button type="button" name="add" class="btn" data-toggle="modal" ng-click="setFlagEdit(false, {})" data-target="#myModal"><img src="../images/add.png"></button>
                                        </div>
                                        <div class="panel-body" >
                                            <table class="table table-hover table-striped">
                                                <thead>
                                                    <tr>
                                                        <th>Type</th>
                                                        <th>Date Caution</th>
                                                        
                                                        <th>Montant (TND)</th>
                                                        <th>Montant Restitué</th>
                                                        <th>Date Restitution</th>
                                                        <th>Etat</th>
                                                        <th></th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr ng-repeat="c in listeCaution">
                                                        <td>{{c.reference}}</td>
                                                        <td>{{c.dateCaution}}</td>
                                                        <td>{{c.mt}}</td>
                                                        <td>{{c.mr}}</td>
                                                        <td>{{c.daterp}}</td>
                                                        <td>{{c.etat}}</td>
                                                        <td><button type="submit" class="btn" data-toggle="modal" data-target="#myModal"  ng-click="setFlagEdit(true, f)" ><img src="../images/edit.png"/></button>&nbsp;&nbsp;&nbsp;
                                                        	<button data-toggle="modal" data-target="#myModal1" type="button" class="btn" ng-click="ConfirmerDelete(c)" ><img src="../images/rubbish-bin-red.png"/></button>
                                                        </td>
                                                    </tr>
                                                </tbody>
                                                <tfoot>
                                                </tfoot>
                                            </table>
                                            <ul class="pagination pagination-lg">
                                            	<li ng-class="{active:$index==pageCourante}" class="clickable" ng-repeat="page in pages track by $index">
                                            		<a ng-click="gotoPage($index)">{{$index}}</a>
                                            	</li>
                                            </ul>
                                        </div>
&#13;
&#13;
&#13;

&#13;
&#13;
var app = angular.module("marcheApp",[]);
app.controller("marcheAppController",function($scope,$http,$window,$location){
	
	
	$scope.marche={};
	$scope.saveMarche=addMarche;
	$scope.saveCaution=addCaution;
	$scope.flagEdit=false;
	$scope.setFlagEdit = function(flag,m){
		$scope.flagEdit=flag;
		$scope.Marche=m;
		$scope.listeCaution=$scope.marche.caution;
		console.log($scope.marche);
	}
	$scope.confirmerDelete= function(m){
		//   url /fournisseurs/f.idFournisseur
		// .post => .delete
	}
	function addMarche(){
		
		//$scope.projet={'matrAdj':$scope.matrAdj,'nomAdj':$scope.nomAdj,'type':$scope.type,'taux':$scope.taux,'pays':$scope.pays,'email':$scope.email,'tel':$scope.tel,'fax':$scope.fax,'adresse':$scope.adresse};
//		$http.post("http://localhost:8080/addFournisseur", $scope.fournisseur)
//		.success(function(data,status,headers,config){
//			//$scope.projet=data;
//			//$scope.chargerProjets();
//		});
		$scope.marche.caution=$scope.listeCaution;
		console.log($scope.marche);
		$http.post('http://localhost:8080/marches',$scope.marche)
		.then(function(response){
//		     $scope.marche=response.data;//(scope.produit=data)on va affiché le prod ajouté avec son id où? allez au html NewProduit.html
//		     $scope.mode=1;//une fois que j'ai les données
			 console.log(response.data);
//			 $scope.chargerFournisseurs();
//			 location.reload();
		},function(response){
		     console.log(response.data);
		});
	}
	

	$scope.pageMarches=[];
	$scope.listeMarches=[];
	$scope.pageCourante=0;
	$scope.pages=[];
	$scope.pageCourante=0;
	$scope.size=5;
	var idc=0;
	var recherche=false;
	$scope.listeCaution=[];
	$scope.chargerMarches=function()
	{
		$http.get('http://localhost:8080/marches?page='+$scope.pageCourante+'&size='+$scope.size,$scope.marche)
		.then(function(response){
			$scope.listeMarches=response.data;
			 console.log(response.data);
			 $scope.pages=new Array(response.data.totalPages);
//			 $('#closeModalAjout').click();
//			 $("#myModal").modal("hide");
			 recherche=false;
		},function(response){
		     console.log(response.data);
		});
		
	}
	
	
	$scope.chargerMarches();
	$scope.gotoPage=function(p){
		$scope.pageCourante=p;
		if (recherche){
			$scope.chercherMarches();
		} else {
			$scope.chargerMarches();
		}
		
	}
	
	
	
	$scope.idMarche;
	

	$scope.chercherMarches=function(){
		$http.get("http://localhost:8080/chercherMarches?idMarche="
				+$scope.idMarche+"&page="+$scope.pageCourante+"&size="+$scope.size)
		.then(function(response){
		     $scope.listeMarches=response.data;
		     $scope.pages=new Array(response.data.totalPages);
		 	recherche=true;
		},function(response){
		     console.log(response.data);
		})
	}
&#13;
&#13;
&#13;

有人可以帮我完成删除功能吗?

以htat方式:表示if和http://localhost:8080/ ..和.delete ConfirmerDelete in img bellow ..非常感谢

0 个答案:

没有答案