I am new to AngularJS and my code unfortunately doesn't work. I want three dropdown fields, but I can only do one. If I use the code as you see below, only the first dropdown works; the second and third are empty.
I have the apprehension that it is because of AngularJS which I don't know, or I forgot...
I already googled this thing, but I didn't find anything that could help me. I have tried a lot of different ways but nothing works.
This is the html:
<!DOCTYPE html>
<html>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body>
//products
<div ng-app="product-selection" ng-controller="product-controller">
<select ng-model="choosenProduct" ng-options="x for x in products"></select>
<div ng-bind = "choosenProduct"></div>
</div>
//formats
<div ng-app="format-selection" ng-controller="format-controller">
<select ng-model="choosenFormat" ng-options="x for x in formats"></select>
</div>
//weights
<div ng-app="weight-selection" ng-controller="weight-controller">
<select ng-model="choosenWeight" ng-options="x for x in weights"></select>
</div>
</body>
</html>
And this is the JS:
<script>
var product = angular.module('product-selection',[]);
var weight = angular.module('weight-selection',[]);
var format = angular.module('format-selection',[]);
//products
product.controller('product-controller', function($scope){
$scope.products = ["Brief", "Postkarte", "Infopost", "Büchersendung", "Warensendung", "PZA" ,"Päckchen", "Blindensendung"];
});
//formats
format.controller('format-controller', function($scope){
$scope.formats = ["Standard", "Kompakt", "Groß", "Maxi", "Maxi bis 2kg"];
});
//weights
weight.controller('weight-controller', function($scope){
$scope.weights = ["0-50g", "51-100g", "101-200g", "201-300g"];
});
</script>