Billy, 

Follow what Sander said then instead of 

value="{{ currUser.first_name }}"

use:
ng-model='currUser.first_name'

Check this out: https://docs.angularjs.org/api/ng/directive/ngModel

"The ngModel directive binds an input,select, textarea (or custom form 
control) to a property on the scope"


On Tuesday, April 29, 2014 8:23:35 PM UTC-7, Billy Figueroa wrote:
>
> I have a question. I would like to know how people handle pre-populated 
> forms.
>
> I am refering to forms for an authenticated user who is a member of the 
> site. There are two types of forms in my application. 
> Registration forms (non member)
> Account forms (members)
>
> I am having a design issue with my member forms. For example update your 
> user email or change your address etc
>
> I noticed when you populate the form using the scope variable i..e
> <input class="span4" type="text" name="first_name" id="first_name" 
> value="{{ currUser.first_name }}">
>
> if I click submit on the form, none of the values are submitted
>
> If go another route and I decide to pre populate the values in the 
> controller then the values are always set and are never updated
>
> i.e.
>
> html
> <input class="span4" type="text" name="first_name" id="first_name"> <--- 
> no value attr, it gets value from controller below...
>
> javascript
>             $scope.account = {
>                 first_name : currUser.first_name,
>                 last_name  : currUser.last_name,
>                 username   : currUser.username,
>                 email      : currUser.email,
>                 phone      : currUser.phone,
>                 address1   : currUser.address1,
>                 address2   : currUser.address2,
>                 city       : currUser.city,
>                 state      : currUser.state,
>                 zipcode    : currUser.zipcode,
>                 country    : currUser.country
>             };
>
>
> I would like a nice elegant way to handle this or at least get some ideas 
> of how people are handling this. I take it I may have to use watchers of 
> some sort
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to