Hi Everybody,
I am new angular js and have urgent requirement to perform CRUD operation on list item.
Searched the net but only got js code without html code .
I am able to read the list item in table but dont know how to update , delete or create the row using angular.
Below is the read code.
<script>var myAngApp = angular.module('SharePointAngApp', []);
myAngApp.controller('spCustomerController', function ($scope, $http) {
$http({
method: 'GET',
url: "https://testing.sharepointdemo.com/sites/km/_api/web/lists/getByTitle('Employee')/items?$select=ID,Title,Designation,location",
headers: { "Accept": "application/json;odata=verbose", 'X-RequestDigest': $('#__REQUESTDIGEST').val() }
}).success(function (data, status, headers, config) {
$scope.customers = data.d.results;
}).error(function (data, status, headers, config) {
});
});
});
}
</script>
</asp:Content>
<%-- The markup in the following Content element will be placed in the TitleArea of the page --%>
<asp:Content ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server">
Page Title
</asp:Content>
<%-- The markup and script in the following Content element will be placed in the <body> of the page --%>
<asp:Content ContentPlaceHolderID="PlaceHolderMain" runat="server">
Click it : <input id="Button1" type="button" value="Get List Item" />
<a href="NewUser.aspx">New Page</a>
<h1>WelCome To Angular JS Sharepoint 2013 REST API </h1>
<div ng-app="SharePointAngApp" class="row">
<div ng-controller="spCustomerController" class="span10">
<input type="text" id="search" ng-model="search" />
<table class="table table-condensed table-hover">
<tr>
<th>ID</th>
<th>User ID</th>
<th>Designation</th>
<th>Location</th>
</tr>
<tr ng-repeat="customer in customers | filter:search">
<td>{{customer.ID}}</td>
<td>{{customer.Title}}</td>
<td>{{customer.Designation}}</td>
<td>{{customer.location}}</td>
</tr>
</table>
</div>
</div>
<div>
Please help from anybody. Its urgent requirement.