JS:
var myApp = angular.module("myTable", []);
myApp.controller("ctrl", function($scope, $http){
$scope.loadData = function(){
$http({
url:"data/studentData.json",
method:"GET"
}).
success(function(resp){
$scope.studentInfo = resp;
});
};
$scope.deleteStudent = function(currIndex){
$scope.studentInfo.splice(currIndex,1);
};
$scope.editStudent = function(currIndex){
$scope.studentInfo.push(sName,sBatch,sJoin,sGrad);
};
/* it was $scope.addStudent but i change it to addData*/
$scope.addData = function(){
$scope.studentInfo.push(sName,sBatch,sJoin,sGrad);
};
$scope.captureFormData = function(){
$scope.studentInfo.push(tempObj);
//in html <input ng-model="sName"/>
//in html <input ng-model="sBatch"/>
//in html <input ng-model="sJoin"/>
var tempObj = {
"name": $scope.sName,
"batch": $scope.sBatch,
"joinDate": $scope.sJoin,
"gradDate": $scope.sGrad
};
}
});