I am currently working on a functionality that involves extracting an object from json and displaying its key-value pairs using 'ng-repeat' in AngularJS. The form includes checkboxes where the value can be either true or false, determining if they should be checked or not.
<form class="form-horizontal">
<div class="form-group form-group__bordered"
ng-repeat="(key, value) in listOfNotificationTypes">
<label for="inputEmail3">{{ key | trimkey }}</label>
<div class="checkbox-wrapper">
<input type="checkbox" class="checkbox" ng-checked="{{value}}">
</div>
</div>
<div class="form-group">
<div class="col-12 clearfix">
<a href="#" class="btn"
ng-click="updateNotificationSettings()">
SAVE
</a>
</div>
</div>
</form>
While everything is functioning correctly, I am now looking to capture any changes made to the key-value pairs when the 'SAVE' button is clicked and send them through another function. I need to ensure that the data is formatted correctly in JSON, like this:
{
"key1":"value1",
"key2":"value2",
"key3":"value3",
...
}
I believe utilizing 'ng-model' will allow me to capture the necessary data, but I am uncertain about the proper implementation. Any guidance on how to achieve this would be greatly appreciated.