-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
36 lines (36 loc) · 873 Bytes
/
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
angular.module('LunchCheck',[])
.controller('LunchCheckController', function($scope)
{
$scope.colour = "";
$scope.message = "";
$scope.lunchItems = "";
$scope.CheckIfTooMuch = function()
{
if($scope.lunchItems === "" || $scope.lunchItems.length === 0)
{
$scope.message = "Please enter data first";
$scope.colour = "red";
}
else
{
var items = $scope.lunchItems.split(",");
for(var i = 0; i < items.length; i++)
{
if(items[i] == "" || items[i] == " ")
{
$scope.message = "Please enter the valid data.";
$scope.colour = "red";
}
else if(items.length <= 3)
{
$scope.message = "Enjoy!";
$scope.colour = "green";
}
else if(items.length > 3)
{
$scope.message = "Too much!";
}
}
}
}
});