I want to show a modal of boostrap which loads another form with angular
Then I leave my code in nodejs
App.js node
app.get ('/nuevoinf/:id/:study', isLoggedIn, function(req, res){
var id = req.params.id;
var study = req.params.study;
var date = Date.now();
var datenow = new Date(date);
var fecha = datenow.toString("dd-mm-yyyy HH:mm");
req.getConnection(function(err,connection){
connection.query('SELECT * FROM patient WHERE pat_id = ?',[id],function(err,data)
{
if(err)
console.log("Error Selecting : %s ",err );
var edad = data[0].created_time - data[0].pat_birthdate;
res.render('informe.ejs',{user : req.user, data : data[0], date: fecha, study: study});
console.log(data);
console.log(date);
});
});
Then what I'm trying to do with angularjs
var myApp = angular.module('angularTodo', ['ui.bootstrap','angularUtils.directives.dirPagination']);
myApp.controller('mainController', ['$scope','$http','$modal', function($scope, $http,$modal){
$http.get('/api/todos').then(function(res) {
$scope.open = function () {
console.log('opening pop up');
var modalInstance = $modal.open({
templateUrl: 'nuevoinf/:id/:study',
});
}
$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)";
});
}]);
I'm a little lost, I'm new to angularjs, I hope they can help me, I do not know how to make the angular controller get the 2 parameters of each patient
I'm sorry for my English
via M. Node
No comments:
Post a Comment