The multiple row input fields are

Using jQuery I created a method to derive JSON
function createReminderJSON() {
jsonObj = [];
$("input[class=occasion]").each(function() {
var occasion = $(this).val();
if ('' !== occasion) {
var fname = $('.fname').val();
var lname = $('.lname').val();
item = {}
item["occasion"] = occasion;
item["firstName"] = fname;
item["lastName"] = lname;
jsonObj.push(item);
}
});
console.log(jsonObj);
$.ajax({
type : "post",
contentType : "application/json",
url : "/add/reminder",
data : JSON.stringify(jsonObj)
});
}
JSON created is
[{occasion:1,firstName:Tim,lastName:Cook},{occasion:1,firstName:Steve,lastName:Jobs}]
HTML of input fields:
<tr>
<td><input type="text" name="occasion" placeholder="occasion" class="occasion" ng-model="rem.occasion"/></td>
<td><input type="text" name="firstName" placeholder="fname" class="fname" ng-model="rem.firstName"/><td>
<td><input type="text" name="lastName" placeholder="lname" class="lname" ng-model="rem.lastName"/><td>
</tr>
Angular JS method invoked on ng-click=addReminder() is
function Reminder($scope,$http){
$scope.addReminder = function() {
var reminders = $scope.rem;
alert(reminders);
$http.post('/add/reminder', reminders).success(function(data) {
alert("Success!");
});
}
}
Is angular.forEach necessary? How can I create JSON using Angular JS silmilar to the jQuery one. The alert is giving me undefined when I tried with a single row input.