-
Notifications
You must be signed in to change notification settings - Fork 4
/
index-ctrl.js
48 lines (35 loc) · 923 Bytes
/
index-ctrl.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
36
37
38
39
40
41
42
43
44
45
46
47
var app = angular.module("repeatApp",['vs-repeat']);
app.factory("safeApply",function(){
return function ($scope, fn) {
var phase = $scope.$root && $scope.$root.$$phase;
if (phase === '$apply' || phase === '$digest') {
if (fn) {
$scope.$eval(fn);
}
} else {
if (fn) {
$scope.$apply(fn);
} else {
$scope.$apply();
}
}
}
});
app.controller("indexCtrl",function($scope){
$scope.CONSTANTS = {
TILE : "tile",
LIST : "list"
}
$scope.dataSet = [];
var sampleData = []
for(var i=0;i<1000;i++)
{
sampleData[i] = i+1;
}
$scope.dataSet = sampleData;
$scope.viewConfig = {};
$scope.viewConfig.tileView = false;
$scope.changeLayout = function(value){
$scope.viewConfig.tileView = (value === $scope.CONSTANTS.TILE) ;
}
})