So I have a client controller like so (with only relevant code):
angular.module('employees').controller('EmployeesController', ['$scope', '$stateParams', '$location', 'Authentication', 'Employees',
function($scope, $stateParams, $location, Authentication, Employees) {
$scope.authentication = Authentication;
// Create new Employee
$scope.create = function() {
// Create new Employee object
var employee = new Employees ({
name: this.name,
eid: this.eid,
availibility: [monday: this.monday, tuesday: this.tuesday]
});
With a client view (again, only code relevant to the availability array)
<div class="form-group form-inline">
<label class="control-label" for="monday">Monday</label>
<label class="control-label" for="start">Start</label>
<label class="control-label" for="finish">Finish</label>
<div class="controls">
<input type="checkbox" id="monday" class="form-control" required>
<input type="time" id="start" class="form-control" required> <input type="time" id="finish" class="form-control" required>
</div>
</div>
<div class="form-group form-inline">
<label class="control-label" for="tuesday">Tuesday</label>
<label class="control-label" for="start">Start</label>
<label class="control-label" for="finish">Finish</label>
<div class="controls">
<input type="checkbox" id="tuesday" class="form-control" required>
<input type="time" id="start" class="form-control" required>
<input type="time" id="finish" class="form-control" required>
</div>
</div>
And a server controller like so:
exports.create = function(req, res) {
var employee = new Employee(req.body);
employee.user = req.user;
console.log(req.body);
employee.save(function(err) {
if (err) {
return res.status(400).send({
message: errorHandler.getErrorMessage(err)
});
} else {
res.jsonp(employee);
}
});
};
How can I make it so that the user can update an "availability" schedule? For some reason, when I POST the form, all I am getting is the eid and name (in the req.body). What am I doing wrong here? Can anyone point me in the direction of a resource that I could use?
Also, another question that kinda has something to do with this: Can I use ngTable to style these forms? As in, can I put forms inside of a table?
Thanks everybody for the help!
P.S. I realize the code is pretty dirty (particular the HTML code + the fact that none of my controllers are actually trying to pull data from the forms yet). Again, I don't have any real reason to continue on to that part until I know why when I POST the form, the data is not included in the post.