I have many forms in my app, some forms are so big that I can't create hardcoded-json keys with values inserted using Angular controllers. I need some automated way to generate JSON from these forms in very trivial structure say {"key":value,"key":value,......} but the problem is I can't create keys in an automated way(say from the element's place-holder or ng-model name). Here's my ionic markup
<ion-view title="Simple test">
<ion-content>
<div class="item bar bar-header bar-{{todo.color}}">
<h1 class="title">{{todo.title}}</h1>
</div>
<div class="list list-inset" id="tust">
<label class="item item-input item-floating-label">
<span class="input-label">Fire and rescue service</span>
<i class="icon ion-android-call placeholder-icon"></i>
<input type="tel" placeholder="Fire and rescue">
</label>
<label class="item item-input item-floating-label">
<span class="input-label">Fire Protection Officer</span>
<i class="icon ion-android-call placeholder-icon"></i>
<input type="tel" placeholder="Fire Protection Officer">
</label>
<label class="item item-input item-floating-label">
<span class="input-label">Fire extinguisher maintenance</span>
<i class="icon ion-android-call placeholder-icon"></i>
<input type="tel" placeholder="Fire extinguisher maintenance">
</label>
<label class="item item-input item-floating-label">
<span class="input-label">Automatic fire alarm maintainer</span>
<i class="icon ion-android-call placeholder-icon"></i>
<input type="tel" placeholder="Automatic fire alarm maintainer">
</label>
Is there a way to get the ng-model name of a model in the controller or is there any other way(even if dirty) to generate keys for json from the element? Thanks