-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapp.simple.js
More file actions
26 lines (21 loc) · 1.32 KB
/
app.simple.js
File metadata and controls
26 lines (21 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var app = angular.module('app', ['ngRows']);
// Controller
app.controller('main', function ($scope) {
var vm = $scope;
// Generate random name data for testing
var firstNames = ['Alan', 'Alice', 'Amber', 'Amanda', 'Barney', 'Bobby', 'Bethany', 'Casey', 'Clayton', 'Cody', 'Dillon', 'Dianne', 'Edward', 'Ethan', 'Eleanor', 'Frank', 'Francene', 'Gary', 'George', 'Georgia', 'Helen', 'Harry', 'Isaac', 'Julia', 'Justin', 'Keith', 'Kathleen', 'Larry', 'Martin', 'Mary', 'Mark', 'Megan', 'Nathan', 'Oliver', 'Philip', 'Ray', 'Rebecca', 'Steve', 'Sara', 'Tina', 'Terry', 'Vince', 'Walter', 'Zeke'];
var lastNames = ['Adams', 'Brown', 'Blevins', 'Clayton', 'Dixon', 'Edwards', 'Fitzgerald', 'Gray', 'Greene', 'Harris', 'Ibanez', 'Jensen', 'Jefferson', 'Johnson', 'Kennedy', 'Lewis', 'Lincoln', 'Martin', 'McGuire', 'Motz', 'Meyer', 'Newton', 'Penn', 'Richards', 'Russell', 'Smith', 'Stevens', 'Sweet', 'Turner', 'Thompson', 'Vick', 'Waters', 'White', 'Woods'];
// Array of row objects to display in the table
vm.names = [];
for (var i = 1; i <= 100000; i++) {
vm.names.push({
id: i,
firstName: firstNames.randomElement(),
lastName: lastNames.randomElement()
});
}
});
// Return a random element from an array
Array.prototype.randomElement = function () {
return this[Math.floor(Math.random() * this.length)];
};