I am doing a project in nodejs with angularjs, I have a doubt, what happens is that I have two tables in the database a patient and another report, and in my index.ejs I show a list of patients in a table with Angular and each patient has the option to register a report and edit report
Then I leave the code of angularjs and nodejs
app.get('/api/todos', function(req, res) {
connection.query('SELECT p1.pat_id, p1.pat_name, p1.pat_birthdate,p1.pat_sex, p1.updated_time, t1.study_desc, t1.mods_in_study, t1.study_iuid FROM patient p1 INNER JOIN study t1 on p1.pk = t1.patient_fk;',function(err, data){
if(err)
{
res.send(err);
}
res.json(data);
});
});
app.js
myApp.controller('mainController', ['$scope','$http','$modal', function($scope, $http, $modal){
$http.get('/api/todos').then(function(res) {
$scope.open = function (titlename) {
var modalInstance = $modal.open({
templateUrl: 'views/informe.ejs',
controller: 'paciente',
resolve: {
titlename2: function () {
return titlename;
}
}
});
}
$scope.pacientes = res.data;
$scope.sort = function(keyname){
$scope.sortKey = keyname; //set the sortKey to the param passed
$scope.reverse = !$scope.reverse; //if true make it false and vice versa
}
}).finally(function() {
$scope.example7 += " (Finally called)";
});
}]);
But the doubt is that I want to hide the link to edit the report a record at a specified time, I explain I want to after a record creates the option to edit this available 20 minutes and then hidden, but my question is in angular js
I do not know how to hcer the difference in each patient's regristo, so I have to do a sql query if each patient has a record in the table report of the contractor only will have the option to create report this would have to do it inside a foreach but not I know how to do it in angular view, I hope you can understand me.
via M. Node
No comments:
Post a Comment