The idea is that pressing the "Edit" button will show the data in the inputs, but I can not find the error
<tr>
<td><input class="form-control" ng-model='materiales.codigo'></td>
<td><input class="form-control" ng-model='materiales.nombre'></td>
<td><input class="form-control" ng-model='materiales.stock'></td>
<td><button class="btn btn-primary" ng-click='addmateriales()'>Agragar Material</button></td>
<td><button class="btn btn-info" ng-click='update()'>Actualizar</button></td>
</tr>
<tr ng-repeat="materiales in listamaterial">
<td>{{materiales.codigo}}</td>
<td>{{materiales.nombre}}</td>
<td>{{materiales.stock}}</td>
<td><button class="btn btn-danger" ng-click="remove(materiales._id)">Remover</button></td>
<td><button class="btn btn-warning" ng-click="edit(materiales._id)">Editar</button></td>
$scope.remove = function(id){
console.log(id);
$http.delete('/listamaterial/' + id).then(function(response){
refresh();
});
};
$scope.edit = function(id){
console.log(id);
$http.get('/listamaterial/' + id).then(function(response){
$scope.materiales = response;
});
};
app.delete('/listamaterial/:id', function(req, res){
var id= req.params.id;
console.log(id);
db.panol.remove({_id: mongojs.ObjectId(id)}, function(err, doc){
res.json(doc);
})
});
app.get('/listamaterial/:id', function(req, res){
var id = req.params.id;
console.log(id);
db.panol.findOne({_id: mongojs.ObjectId(id)}, function(err , doc){
res.json(doc);
});
});