Hi,
Following is my working code for adding a row in atable using angularjs
<script>
var app = angular.module("myApp", []);
app.controller("myCtrl", function ($scope, $http) {
debugger;
$scope.InsertEmp = function (Emp) {
$scope.Message = null;
$scope.Emp = {};
$scope.Emp.FirstName=$scope.FirstName;
$scope.Emp.LastName = $scope.LastName;
$scope.Emp.Company = $scope.Company;
$http({
method: "post",
url: "/Home/Insert",
data: JSON.stringify($scope.Emp)
}).then(function (response) {
if (response.data == 'Employee Added Successfully') {
$scope.FirstName = null;
$scope.LastName = null;
$scope.Company = null;
$scope.Message = "Record Added Successfully";
$scope.myStyle = { color: "green", background: "white" }
}
else {
$scope.Message = "Record Not Added";
$scope.myStyle = { color: "red", background: "white" }
}
})
};
});
</script>
My requirement is to display the current record in the table as last record.
ie the table already contains some records
I want to display the current record in the last row
code should be inside the following code
if (response.data == 'Employee Added Successfully') {
$scope.FirstName = null;
$scope.LastName = null;
$scope.Company = null;
$scope.Message = "Record Added Successfully";
$scope.myStyle = { color: "green", background: "white" } }
how it is possible
Regards
Baiju