I am trying to display the data in a mysql table
I fall below my app.js node code
app.get('/api/todos', function(req, res) {
connection.query('SELECT * FROM pacsdb.ae',function(err, data){
if(err)
{
res.send(err);
}
res.send(data);
//res.render('pacientes',{data:data});
console.log(data);
});
});
The console if it shows me the data obtained by the SQL but the problem comes in the view with angular
Here I leave you the code of app.js of angularjs
Var myApp = angular.module ('angularTodo', []);
MyApp.controller ('mainController', ['$ scope', '$ http', function ($ scope, $ http)
$ Http.get ('/ api / all'). Then (function (value) {
$ Scope.pacientes = value;
}). Finally (function () {
$ Scope.example7 + = "(Finally called)";
});
}]);
And the view
<Table class = "table" style = "border: 2px">
<Thead>
<Th> ID; </ Th>
</ Thead>
<Tbody>
<Tr ng-repeat = "date in patients">
<Td> </ td>
</ Tr>
</ Tbody>
</ Table>
The problem is that when data [0] .pk if the data is displayed at position 0, but I want to display all the data in the mysql table, but so data.pk does not display anything in the view
I'm sorry for my English.
via M. Node
No comments:
Post a Comment