Nopes. I want to create json(key as element name attr) from the form using
angular ng-submit or any other angular methods.
On Jan 17, 2014 11:51 PM, "Jacob Biggs" <[email protected]> wrote:
> Disregard that, this is what you want:
>
> <form data-ng-submit="submitInvoiceForm();" name="myForm" novalidate>
> <input type="text" name="myNumber" ng-model="form.myNumber" value="entered
> number"/>
> <input type="text" name="myText" ng-model="form.myText" value="entered
> text"/>
> <input type="submit" value="save"/>
> </form>
>
> $scope.form = { myNumber: 'entered number', myText: 'entered text' };
>
>
>
> On Friday, January 17, 2014 11:14:58 AM UTC-7, Jacob Biggs wrote:
>>
>> <form data-ng-submit="submitInvoiceForm();" name="myForm" novalidate>
>> <input type="text" name="myNumber" ng-model="number" value="entered
>> text"/> <!-- input name will automatically become property of myForm -->
>> <input type="submit" value="save"/>
>> </form>
>>
>> console.log($scope.myForm); // {myNumber: "entered text" }
>>
>> On Friday, January 17, 2014 6:38:16 AM UTC-7, Pushpendra Kumar wrote:
>>>
>>> Hello,
>>>
>>> Can we create form json taking html field's name attribute as
>>> key.
>>> <html>
>>> <form data-ng-submit="submitInvoiceForm();" name="myForm"
>>> novalidate>
>>> <input type="text" name="Form.myNumber" ng-model="number" value="entered
>>> text"/>
>>> <input type="submit" value="save"/>
>>> </form>
>>> json:Form
>>>
>>> </html>
>>>
>>> Now I want form json as:
>>> {myNumber:"entered text"}
>>>
>>> don't want json as:
>>> {number:"entered text"}
>>>
>>> can we do this using angular best practices?
>>>
>> --
> 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/groups/opt_out.
>
--
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/groups/opt_out.