Speak up. I am a beginner in Angular and would like help with this form.
<html ng-app="app">
<head>
<title>Teste</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.js"></script><script>angular.module('app',[]);angular.module('app').controller('MyCtrl',functionMyCtrl($http,$scope){$http.get('https://fipe-parallelum.rhcloud.com/api/v1/carros/marcas').success(function(data){$scope.greeting=data;});$scope.carregarModelo=function(modelo){$http.get("https://fipe-parallelum.rhcloud.com/api/v1/carros/marcas/"+modelo+"/modelos").success(function (data) {
$scope.modelo = data;
});
};
});
</script>
</head>
<body ng-controller="MyCtrl">
<div>
<h1>Marcas</h1>
<select id="teste1" class="customSel">
<option ng-click="carregarModelo({{ x.codigo }})" ng-repeat="x in greeting" value="{{ x.codigo }}">{{ x.nome }}</option>
</select>
</div>
<div>
<h1>Modelo</h1>
<select id="teste2" class="customSel">
<option value="0" selected>Selecione</option>
<option ng-repeat="x in modelo" value="{{ x.codigo }}">{{ x.nome }}</option>
</select>
</div>
</body>
I'm trying to create a form that queries which car brand is selected, and then gives the name of the cars that refer to that brand.
The part of consulting the brand already works, I could not make the list of cars work, because I can not pass on the value of the brand to a new function, could you help me? Thanks.