File tree Expand file tree Collapse file tree 7 files changed +51
-0
lines changed Expand file tree Collapse file tree 7 files changed +51
-0
lines changed File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change 1+ ( function ( ) {
2+
3+ angular . module ( 'LunchCheck' , [ ] )
4+ . controller ( 'LunchCheckController' , LunchCheckController ) ;
5+
6+ LunchCheckController . $inject = [ '$scope' ] ;
7+
8+ function LunchCheckController ( $scope ) {
9+ $scope . name = "" ;
10+ $scope . messages = "" ; //for message
11+ $scope . msgClass = "text-success" ; //for color of o/p msg
12+ $scope . msgBorder = "" ; //for border of input text box
13+
14+ $scope . check = function ( ) {
15+
16+ var input = $scope . name ;
17+ var numberOfTypes = input . split ( "," ) ;
18+ var numberOfItems = 0 ;
19+
20+ for ( var i = 0 ; i < numberOfTypes . length ; i ++ ) {
21+ if ( numberOfTypes [ i ] . trim ( ) !== "" ) {
22+ numberOfItems ++ ;
23+ }
24+ }
25+
26+ if ( numberOfItems === 0 )
27+ {
28+ $scope . messages = "Please enter data first" ;
29+ $scope . msgClass = "text-danger" ;
30+ $scope . msgBorder = "messageError" ;
31+ }
32+ else if ( numberOfItems <= 3 )
33+ {
34+ $scope . messages = "Enjoy!" ;
35+ $scope . msgClass = "text-success" ;
36+ $scope . msgBorder = "messageSuccess" ;
37+ }
38+ else
39+ {
40+ $scope . messages = "Too much!" ;
41+ $scope . msgClass = "text-danger" ;
42+ $scope . msgBorder = "messageError" ;
43+ }
44+ } ;
45+
46+ } ;
47+
48+
49+
50+
51+ } ) ( ) ;
File renamed without changes.
File renamed without changes.
You can’t perform that action at this time.
0 commit comments