私は選択した入力のリストを持っていますが、リストから製品を選択するたびに "duplicateGammeProduit"を呼び出すだけですこの製品のIDを送信するが、私は気づくことは、私はすべてのオプションを選択する前にこのメソッドが呼び出されるということです、これは私のコードです:オプションを選択入力で選択する前に関数の呼び出しを停止する方法
<select ng-model="produitId" ng-change="duplicateGammeProduit(produitId)">
<option ng-repeat="pi in listProduitUsed" value="{{pi.id}}">{{pi.reference}}</option>
</select>
、これはコントローラのコードです:そう
.controller(
'GammeCtrl', [
'$scope',
'$http',
function($scope, $http) {
$scope.duplicateGammeProduit = function(produitId) {
$http.get(MyURL:" +produitId).success(
function(gammeProduit) {
//the method to be called when an option is selected
$scope.classifierListElementGamme(gammeProduit.listElementGamme);
gammeProduit.id = null
....
$scope.finalOperationsList = gammeProduit.listElementGamme;
});
}
$scope.listeProduitUsed = function() {
$http
.get(URL/getProduitListUsed")
.success(
function(dataProduit) {
$scope.listProduitUsed = dataProduit;
});}
$scope.listeProduitUsed();
}]);
この通話のためにオプションの選択前にこの通話を停止するにはどうすればいいですか slo私のアプリダウンWSヘルプ
であなたは$ http.get要求する前に検証を追加することにより試みることができる同じ考え。 if(!produitId){return; } – mtamma