-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
35 lines (35 loc) · 1.14 KB
/
script.js
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
27
28
29
30
31
32
33
34
35
angular.module('myApp', ['smart-table', 'ngTableToCsv'])
.controller('mainCtrl', ['$scope', function ($scope) {
var nameList = ['Pierre', 'Pol', 'Jacques', 'Robert', 'Elisa']
var familyName = ['Dupont', 'Germain', 'Delcourt', 'bjip', 'Menez']
var namesCount = nameList.length
function createRandomItem() {
var
firstName = nameList[Math.floor(Math.random() * namesCount)],
lastName = familyName[Math.floor(Math.random() * namesCount)],
age = Math.floor(Math.random() * 100),
email = firstName + lastName + '@example.com',
balance = Math.random() * 3000
return {
firstName: firstName,
lastName: lastName,
age: age,
email: email,
balance: balance
}
}
$scope.displayed = []
for (var j = 0; j < 50; j++) {
$scope.displayed.push(createRandomItem())
}
$scope.defaultPageSize = 20
$scope.itemsPerPage = $scope.defaultPageSize
}])
.directive('stRatio', function () {
return {
link: function (scope, element, attr) {
var ratio = +(attr.stRatio)
element.css('width', ratio + '%')
}
}
})