-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
44 lines (33 loc) · 1.04 KB
/
Copy pathapp.js
File metadata and controls
44 lines (33 loc) · 1.04 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
(function(angular) {
'use strict';
var _moduleId = 'abd',
_start = new Date().getTime();
angular.module(_moduleId, [])
.directive("onLastRepeat", onLastRepeat)
.controller('bigdata', controller);
controller.$inject = ['$scope', '$http'];
function controller($scope, $http) {
var _vm = this;
log('controller started');
// load the data
$http.get('data.json')
.success(onDataLoad);
$scope.$on('onRepeatLast', function(scope, element, attrs) {
log('rows loaded');
});
function onDataLoad(data) {
log('data loaded');
$scope.data = data;
}
}
function log(message) {
console.log(message + ' time:' + (new Date().getTime() - _start) + 'ms');
}
function onLastRepeat() {
return function(scope, element, attrs) {
if (scope.$last) setTimeout(function() {
scope.$emit('onRepeatLast', element, attrs);
}, 1);
};
}
})(angular);