AngularJS: Create / Add / Delete User

546 views
Skip to first unread message

Darold Davis

unread,
Jan 31, 2013, 6:06:33 PM1/31/13
to ang...@googlegroups.com
Any AngularJS users code (or seen) a "create user profile" or "update profile" example? What would the ng-model and ng-controller look like?
Point the way to any examples. My searches haven't yielded any.

A MVC diagram (in UML perhaps) would also be fitting and helpful, since Angular is MVC

Thanks in advance
Darold 

tas pas

unread,
Feb 1, 2013, 6:54:44 AM2/1/13
to ang...@googlegroups.com
Hello Darold, 

I'm creating an app with the same requirements. I'm not going to show you what I'm I doing since I can't quite get plunker work but I will explain you what I'm doing:

In order to create users in a database I'm using a language to talk to my database.
In my case php but you can use whatever you like for this.

In order to create a user, I present a form which every field has an ng-model such as: user.name / user.surname / user.pass etc...
This form has a controller called createUserCtrl.
This controller has an object/array called $scope.user.
Whenever a user fills the form that array gets updated, so the $scope.user array hold the info for the user.

The form also has an ng-submit attribute which calls a function from the controller, say function submitUser(), which uses the $http service and posts the array to my php page that handles the database entry.

Hope that it helps.

Tasos

Darold Davis

unread,
Feb 1, 2013, 1:31:58 PM2/1/13
to ang...@googlegroups.com
Hello Tasos

Thank you for the excellent explanation. Below is my plunker to what I have so far:
http://plnkr.co/edit/0nIItyNBpyBSNiF6illv?p=preview

For the registered users in the table, I would like the modal to display info that is associated with that user
when their name is clicked on.

I will try some of the suggestions you mentioned and give you an update status.

At work, in addition to AngularJS we are using Node.js, MongoDB and Redis

Many Thanks
Darold
Reply all
Reply to author
Forward
0 new messages