Closed ralyodio closed 10 years ago
Actually, the 2.0 version will have a socket.io option, which will scaffold a real time crud interface for Things. For reference: https://github.com/DaftMonk/modular-fs/blob/socketio/client/app/main/main.controller.js
Can you provide an example with the current version? I'm not using sockets. I tried picking apart the User model to recreate it for Things using $resource, but I keep getting an undefined error when I call form.$save
+1 on some basic examples with CRUD operations. Users, Products, Gallery or something of the sort.
I'm doing Post, but just crud on Things would be nice. Have it be an optional install if you don't want everyone getting it. But I've been stuck on this issue for like 3 days now. Cannot seem to figure it out.
Working example: http://plnkr.co/edit/KQR1EZPqW0MjLTorCmMr?p=preview
Fullstack code:
http://plnkr.co/edit/5lFHCuCXyadIgXxG2YvB
(here i get error: TypeError: undefined is not a function
at form.$save()
)
Not sure where I'm going wrong.
For an example with the current version: https://github.com/DaftMonk/mean-todomvc/blob/master/app/scripts/controllers/main.js
still getting TypeError: undefined is not a function
on job.save()
. I must be missing something obvious. It has something to do with this in the catch(fn(err))
:
form[field].$setValidity('mongoose', false);
you motivated me to take a more aggressive debugging approach. I resolved it.
Confusion lies with $scope.form = {}
and <form name="form" ng-submit="save(form)">
this does not work, as the objects collide.
I changed it to $scope.newJob = {};
and in view <input ng-model="newJob.title">
and <form name="job" ng-submit="save(job)">
Its a little confusing on how to stub out a client interface for doing CRUD operations. It would be awesome if we could have "Things" page for creating, reading, updating, and deleting them. At least as an option. The only create done in the UI is user, which uses both Auth and User and I'm a little confused on how to go about providing api/service for a Thing object.