HTML:
</head>
<body>
<div ng-controller="tableController">
<table ng-table="usersTable" class="table table-striped">
<tr ng-repeat="user in data">
<td data-title="'Id'">
{{user.id}}
</td>
<td data-title="'First Name'">
{{user.first_name}}
</td>
<td data-title="'Last Name'">
{{user.last_name}}
</td>
<td data-title="'e-mail'">
{{user.email}}
</td>
<td data-title="'Country'">
{{user.country}}
</td>
<td data-title="'IP'">
{{user.ip_address}}
</td>
</tr>
</table>
</div>
</body>
</html>
JAVA:
angular.module('ngTableTutorial', ['ngTable'])
.controller('tableController', function ($scope, $filter, ngTableParams) {
$scope.users = [{ "id": 1, "first_name": "Philip", "last_name": "Kim", "email": "pkim0@mediafire.com", "country": "Indonesia", "ip_address": "29.107.35.8" },
{ "id": 2, "first_name": "Judith", "last_name": "Austin", "email": "jaustin1@mapquest.com", "country": "China", "ip_address": "173.65.94.30" },
{ "id": 3, "first_name": "Judith", "last_name": "Austin", "email": "jaustin1@mapquest.com", "country": "China", "ip_address": "173.65.94.30" },
{ "id": 8, "first_name": "Judith", "last_name": "Austin", "email": "jaustin1@mapquest.com", "country": "China", "ip_address": "173.65.94.30" },
{ "id": 9, "first_name": "Judith", "last_name": "Austin", "email": "jaustin1@mapquest.com", "country": "China", "ip_address": "173.65.94.30" },
{ "id": 16, "first_name": "Andrea", "last_name": "Greene", "email": "agreene4@fda.gov", "country": "Russia", "ip_address": "128.72.13.52" }];
$scope.usersTable = new ngTableParams({
page: 1,
count: 10
}, {
total: $scope.users.length,
getData: function ($defer, params) {
$scope.data = $scope.users.slice((params.page() - 1) * params.count(), params.page() * params.count());
$defer.resolve($scope.data);
}
});
});
CONTROLLER:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Magazyn.Controllers
{
public class BazaController : Controller
{
public ActionResult Index()
{
return View();
}
}
}
I need to use simple LocalDB or SQLExpress database file instead $scope.users.. static table.??? Please for Help. Thanx:)