I have a massive form with more or less 80 / 90 inputs.
My main problem is How can I pass all those inputs belonging to unique form in an ajax request without map the inputs manually into a object?
I know that with jquery you can use serialize()
function selecting the form. Is there any helper function in angular to achieve that?
Thanks
Indeed, as Michal's comment suggested, it doesn't look like you are using
ng-model
.Angular's jqLite doesn't support
serialize()
since with Angular one would typically build a ViewModel that would then be bound to a form.But, if you are out of luck, you could add jQuery.js to get the
serialize()
support and create a simple directive -serializer
- that would act on a form.And use it as follows:
And in the controller:
plunker
EDIT:
If you are using
ng-model
and in fact have a proper ViewModel, then this is the "Angular way" and so, you should have some object that is bound to the form inputs - you should just submit that.