-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
48 lines (35 loc) · 1.13 KB
/
app.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
48
(function () {
'use strict';
angular.module('LunchCheck', [])
.controller('LunchCheckController', LunchCheckController);
LunchCheckController.$inject = ['$scope'];
function LunchCheckController($scope) {
$scope.Lunch_elements = " ";
$scope.message = " ";
//$scope.test_1 = " ";// SplitLunchElements(array)
//$scope.test_2 = 0; // Count_Lunch_elements(array)
$scope.CheckIfTooMuch = function () {
var No_Lunch_Elements=Count_Lunch_elements($scope.Lunch_elements);
var message = "LOOL ";
if (No_Lunch_Elements <= 3){
message = "enjoy!";
}
else{
message = "Too much!";
}
$scope.message = message;
// $scope.test_1 = SplitLunchElements($scope.Lunch_elements);
// $scope.test_2 = Count_Lunch_elements($scope.Lunch_elements);
};
}
function Count_Lunch_elements(array) {
var LunchElements= SplitLunchElements(array);
var LengthOfLunchElements= LunchElements.length;
return LengthOfLunchElements;
}
function SplitLunchElements(array){
var Lunch_elements = array;
var arrayOfElements = Lunch_elements.split(",");
return arrayOfElements;
}
})();