forked from grishrl/grishrl.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rowTemplate.js
42 lines (31 loc) · 982 Bytes
/
rowTemplate.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
angular.module('uctc').directive('rowTemplate',function(){
var directive = {};
directive.templateUrl = 'rowTemplate.html';
directive.restrict = 'E';
directive.controller = 'rowTemplateController';
directive.controllerAs = 'ctrl';
return directive;
});
angular.module('uctc').controller('rowTemplateController',function(constants, caLogic, totalFactory, $scope){
$scope.model={};
$scope.unitList = constants.unitList;
var numberToShow = 10;
var arrayToShow = [];
for(var i = 0; i<numberToShow; i++){
arrayToShow.push(i+1);
}
$scope.numbers = arrayToShow;
$scope.addRow=function(){
$scope.$emit('addRow');
};
$scope.total = [];
$scope.calculate=function(ind){
var tempReturn = caLogic.requiredForUnit($scope.model)
$scope.returnedCalcs=tempReturn;
if(totalFactory.totalsArray[ind]){
totalFactory.totalsArray[ind]=tempReturn;
}else{
totalFactory.totalsArray.push(tempReturn);
}
};
});