-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
39 lines (30 loc) · 882 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
37
38
39
(function () {
'use strict';
angular.module('LunchCheck', [])
.controller('LunchCheckController', LunchCheckController);
LunchCheckController.$inject = ['$scope'];
function LunchCheckController($scope, handleLunch) {
$scope.lunch = "";
$scope.msglunch = "";
$scope.msg = function () {
// begin handle empty item for ",," or ", ," or ",,,"
var vLunch = $scope.lunch.replace(",,,",",");
vLunch = vLunch.replace(",,",",");
vLunch = vLunch.replace(", ,",",");
//end handle empty item for ",," or ", ," or ",,,"
var aLunch = vLunch.split(",");
var lenLuch = aLunch.length;
if($scope.lunch.length == 0){
$scope.msglunch = "Please enter data first";
}else{
if(lenLuch <= 3){
$scope.msglunch = "Enjoy!";
}else{
if(lenLuch > 3){
$scope.msglunch = "Too much!";
}
}
}
};
}
})();