Friday, 9 June 2017

Error res.render, function not defined

getting error res.render not define when i am using split function under while loop.

router.get("/hr/available",middleware.isLoggedIn,function(req,res){
Employee.find({},function(err,employees){
  if(err){
        console.log(err);
    }else{
    var available = [];
    var i =0;
    while(i<employees.length){
      var res = employees[i].dateto.split("-");
      var day = res[0];
      var month = res[1];
      var year = res[2];
      month = month-1
      available.push(employees[i]);
      i++;
    }
  res.render("hr/availableCV's" ,{employees:available});
}
available = [];
}); });



via Faizan Rasheed

No comments:

Post a Comment