I have a issue on updating a input value based on another input value. I've "J" input and "U" input. When J is changed I need the values updated in U input. And I want to do this with angularjs. I've done a simple angularj js controller to get the values from database:
<script>
var tip = "uat_superior";
var judet = $('#judet').val();
var address = "cautare.php?tip=" + tip + "&judet="+judet;
var app = angular.module('myApp', []);
app.controller('uat_superior_data', function ($scope, $http) {
$http.get(address)
.then(function (response) {
$scope.rez = response.data.records;
});
$scope.OnChangeJudet=function()
{
$http.get(address)
.then(function (response) {
$scope.rez = response.data.records;});
}
});
But it doesn't work.
How can I make the controller to update the data after a input is changed?
I've tried with $('#inputJ').change(function () { the code above});
and it doesn't work. And Google didn't helped me too much for this question.
THank you