I'm trying to bind some data that is coming from ms sql database to a single page angular. apparently everything is working fine and I can see the data in json format in network response of the browser but the problem is data cannot bind to ng-repeat tag in html file.
here is my html file
<div class="row">
<h1>Users</h1>
<div class="span10">
<table class="table table-condenced table-hover">
<tr>
<th>User</th>
<th>user firstname</th>
<th>user lastname</th>
</tr>
<tr ng-repeat="user in users">
<th>{{user.UserID}}</th>
<th>{{user.Lastname}}</th>
<th>{{user.Firstname}}</th>
</tr>
</table>
</div>
here is my model
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Formatting;
using System.Web;
using System.Web.Helpers;
using System.Web.Http.Controllers;
using System.Web.Mvc;
namespace Angular4DotNetMVC.Models
{
public WoUser[] GetUsers()
{
MyScreensEntities xEntity = new MyScreensEntities();
List<User> xList = new List<User>();
List<WoUser> userList = new List<WoUser>();
xList = (from x in xEntity.Users select x).Take(20).ToList();
if (xList != null)
{
foreach (User obj in xList)
{
WoUser yUser = new WoUser();
yUser.Userid = obj.UserID;
yUser.Userfirstname = obj.UserFirstname;
yUser.Userlastname = obj.UserLastname;
userList.Add(yUser);
}
}
WoUser[] myArray = userList.ToArray();
return myArray;
}
}
}
this is my controller
namespace Angular4DotNetMVC.Controllers
{
public class UserController : ApiController
{
private RegistrationVmBuilder obj = new RegistrationVmBuilder();
public WoUser[] Get()
{
return obj.GetUsers();
}
}
}