Hi You should send message on this mailing list only in English.
Thanks Manu @EmmanuelDemey Le 13 août 2015 11:50, "Alexander Wodjanko" < [email protected]> a écrit : > Hallo Alle! > > ich habe ein kleines Problem mit dem Formular. > > ich habe ein controller.js, und so sieht mein Formular aus: > > Controller: > > ////////////////////////////////////////////////////////////////////////////////////////// > > (function() { > var FilterController; > FilterController = function($scope, $http) { > > $scope.marken = [ > {name: "Alle", value: ""} > ]; > $scope.models = [ > {name: "Alle", value: ""} > ]; > $scope.accessories = [ > {name: "Alle", value: ""} > ]; > > $scope.filterMarke = function(article){ > if ($scope.filter_marke.value == "") { > return true > } else { > return article.marke == $scope.filter_marke.value > } > } > > $scope.filterAccessories = function(article){ > if ($scope.filter_accessor.value == "") { > return true > } else { > return article.accessor == $scope.filter_accessor.value > } > } > > $scope.filterModel = function(article){ > if ($scope.filter_model.value == "") { > return true > } else { > return article.modell == $scope.filter_model.value > } > } > > $scope.filterModelOptions = function(option){ > if ($scope.filter_marke.value == "") { > return true > } else { > return option.marke == $scope.filter_marke.value > } > } > > $scope.getData = function() { > > $http.get("/wp-admin/admin-ajax.php?action=getArticle").success(function(d) > { > $scope.articles = d.data; > d.data.forEach(function(item){ > if ($scope.marken.filter(function(marke){return marke.name == > item.marke}).length < 1) { > $scope.marken.push({name: item.marke, value: item.marke}); > } > $scope.filter_marke = $scope.marken[0] > > if ($scope.models.filter(function(model){return model.name == > item.modell}).length < 1) { > $scope.models.push({name: item.modell, value: item.modell, > marke: item.marke}); > } > $scope.filter_model = $scope.models[0] > > if ($scope.accessories.filter(function(accessor){return > accessor.name == item.accessor}).length < 1) { > $scope.accessories.push({name: item.accessor, value: > item.accessor}); > } > $scope.filter_accessor = $scope.accessories[0] > }) > }); > }; > $scope.getData(); > }; > rthardtop.controller("FilterController",FilterController) > > }).call(this); > > > ////////////////////////////////////////////////////////////////////////////////////////// > > Und Formular: > > <div ng-controller="FilterController"> > <form id="catalog-form" method="post" action=""> > <select name="auto_marken" id="auto_marken" class="form-control" > ng-model="filter_marke" ng-options="marke.name for marke in marken track > by marke.value"></select> > <select name="auto_modell" id="auto_modell" class="form-control" > ng-model="filter_model" ng-options="model.name for model in models track > by model.value"></select> > <select name="auto_accessor" id="zubehoertyp" class="form-control > col-xs-12" ng-model="filter_accessor" ng-options="accessor.name for > accessor in accessories track by accessor.value"></select> > <span id="search_count" class="">{{filtered.length}}</span> > <input type="submit" name="submit" value="Show results"> > </form> > <ul class="hide"> > <li style="color: #fff;" ng-repeat="article in filtered = ( articles > | filter: filterMarke | filter: filterModel | filter: > filterAccessories)">{{article}}</li> > </ul> > </div> > > > > ////////////////////////////////////////////////////////////////////////////////////////// > > > Leider werden bei mir nach dem Formularversand nur die ersten Optionen mit > Value "Alle" als selected markiert. Dadurch wird die falsche Anzahl von den > gefundenen Artikel angezeigt. > > Kann mir bitte jemand sagen, wie ich die entpsrechende Optionen nach dem > Formversand "selected" mache? Ich bin deswegen wirklich verzweifeilt, habe > vieleis ausprobiert und komme einfach nicht weiter. > > Ich danke Euch alle im Voraus! > > -- > You received this message because you are subscribed to the Google Groups > "AngularJS" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/angular. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
