I have used syncfusion grid and i want to bind data to syncfusion grid from API but data binding to syncfusion grid is not working
here is HTml code for grid
<div ng-controller="ContactsController as contact">
<div id="Grid" ej-grid e-datasource="contact.Cdata" e-columns="contact.columns" e-toolbarsettings='contact.tools' e-toolbarclick="contact.toolbarHandler"
e-editsettings="contact.edittsetings" e-allowsorting="contact.allowsorting" e-sortsettings="contact.sortsettings" e-actionbegin="contact.actionBegin" e-allowpaging="contact.allowpaging"
e-pagesettings="contact.pagesettings" e-editsettings="contact.editsettings" e-allowreordering="contact.allowReordering" e-allowresizing="contact.allowResizing">
</div>
</div>
Here is Controller method::
function ContactsController(CommonService) {
this.Cdata = [];
var d = CommonService.getCantactList();
d.then(function (response) {
ContactsController.prototype.Cdata = response.data.Items;;
console.log("success");
}, function (error) {
console.log("error");
});
}
and the commonService is
this.getCantactList = function () {
return $http.get("http://localhost:63138/api/Contact/GetContactsbyClientId?clientId=1", { cache: true });
}
And the API method is::
public object GetContactsbyClientId(int clientId)
{
try
{
//return (ContactService.GetListByClientId(clientId));
return new { Items = ContactService.GetListByClientId(clientId) };
}
catch (Exception)
{
throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
{
Content = new StringContent("An error occurred, please try again or contact the administrator."),
ReasonPhrase = "Critical Exception"
});
}
}