JSFiddle - React, Tailwind, and code Playground
by Nofiden Noble
HTML
<div ng-app="myApp">
<div ng-controller="FormCtrl" >
ID: <br/><input type="text" ng-model="patient.appPatientId"> <br/><br/>
FirstName: <br/><input type="text" ng-model="patient.firstName"> <br/><br/>
LastName: <br/><input type="text" ng-model="patient.lastName"> <br/><br/>
Country: <br/><input type="text" ng-model="patient.contactInfo.country"> <br/><br/>
<input type="radio" ng-model="patient.sex" value="female" />Female ...
<input type="radio" ng-model="patient.sex" value="male" />Male <br/><br/>
Assigned Pathologist contactInfo: <br/><input type="text" ng-model="patient.assignedPathologist.contactInfo.email"> <br/><br/>
<br/><br/>
<button ng-click="save()" >Save</button>
<textarea ng-model="finalJson" rows="5" cols="60"></textarea>
</div>
</div>
JavaScript
var app = angular.module('myApp', []);
app.controller('FormCtrl', function ($scope, $http) {
$scope.save = function() {
formData = $scope.patient;
$scope.finalJson = JSON.stringify(formData);
console.log (JSON.stringify(formData));
};
});