I have a problem trying to pull a $ scope data and insert it as value in input.
This value is determined from a select that is part of my form code. The select that determines is "Resource" and I put condition that if it is "Municipal" I pull a data from a $ scope function and put it as value in the input and then that value is saved in a database, but I do not achieve make it appear from the $ scope is reflected in the input.
Could you please help me?
FORM
<form ng-submit="registrar()" >
<div class="form-group col-sm-1">
<label for="ID">ID</label>
<input type="text" class="form-control" ng-model="IDObra" >
</div>
<div class="form-group col-sm-2">
<label for="Recurso">Recurso</label>
<select ng-model="recurso" class="form-control" name="recurso">
<option ng-value="Municipal" >Municipal</option>
<option id="dos" ng-value="Estatal">Estatal</option>
<option id="dos"ng-value="Federal">Federal</option>
</select>
</div>
<div class="form-group col-sm-2" >
<label for="numObra">No. Obra </label>
<input type="text" class="form-control" ng-if="recurso == 'Municipal'" ng-model="numObra" ng-init="value='{{numero}}'">
</div>
angular driver
var empleadoControllers = angular.module('empleadoControllers', []);
empleadoControllers.controller('EmpleadoListadoCtrl', ['$scope','$http', function ($scope, $http) {
numero();
empleados();
profesiones();
function numero(){
$http.get('http://localhost:8888/base2/api/?a=numero').then(function(r){
$scope.numero = r.data;
});
}
function empleados(){
$http.get('http://localhost:8888/base2/api/?a=listar').then(function(r){
$scope.model = r.data;
});
}
}