<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<sctirp>
var app = angular.module("myApp", []);
app.controller('myCtrl', function ($scope, $http)
{
$scope.ButtonClick = function ()
{
$scope.CommonMethod();
}
$scope.CommonMethod = function () {
var webAbsoluteURL = _spPageContextInfo.webAbsoluteUrl;
var methodURL = webAbsoluteURL + "/_layouts/15/MainDashBoad/WebMethod.aspx/BindTasks";
var param = {};
param.localCulturalId = "1033";
param.taskBox = "Inbox";
param.days = "All";
param.WebURL = webAbsoluteURL;
var mYData = $http({
method: "POST",
url: methodURL,
dataType: 'json',
data: param,
headers: {
"Content-Type": "application/json"
}
});
mYData.success(function (data, status) {
$scope.showData = JSON.parse(data.d);//data.d;
console.log(JSON.parse(data.d));
});
mYData.error(function (data, status) {
$scope.status = status;
console.log(status);
});
}
});
</script>
<div ng-app="myApp" >
<div ng-controller="myCtrl">
<input id="getData" type="button" value="GetData" ng-click="ButtonClick()" />
<table border="1">
<tr ng-repeat="x in showData">
<td>{{x.ProcessName}}</td>
<td>{{x.ProjectName}}</td>
</tr>
</table>
</div>
</div>
<sctirp>
var app = angular.module("myApp", []);
app.controller('myCtrl', function ($scope, $http)
{
$scope.ButtonClick = function ()
{
$scope.CommonMethod();
}
$scope.CommonMethod = function () {
var webAbsoluteURL = _spPageContextInfo.webAbsoluteUrl;
var methodURL = webAbsoluteURL + "/_layouts/15/MainDashBoad/WebMethod.aspx/BindTasks";
var param = {};
param.localCulturalId = "1033";
param.taskBox = "Inbox";
param.days = "All";
param.WebURL = webAbsoluteURL;
var mYData = $http({
method: "POST",
url: methodURL,
dataType: 'json',
data: param,
headers: {
"Content-Type": "application/json"
}
});
mYData.success(function (data, status) {
$scope.showData = JSON.parse(data.d);//data.d;
console.log(JSON.parse(data.d));
});
mYData.error(function (data, status) {
$scope.status = status;
console.log(status);
});
}
});
<div ng-app="myApp" >
<div ng-controller="myCtrl">
<input id="getData" type="button" value="GetData" ng-click="ButtonClick()" />
<table border="1">
<tr ng-repeat="x in showData">
<td>{{x.ProcessName}}</td>
<td>{{x.ProjectName}}</td>
</tr>
</table>
</div>
</div>
No comments:
Post a Comment