title: How to split a string in Angular.js?
body: <p>This is my view</p>
  
  <pre><code>&lt;div class="container" ng-controller="LunchCheckController"&gt;
    &lt;h1&gt;Lunch Checker&lt;/h1&gt; 
        &lt;div class="form-group" &gt;
            &lt;input id="lunch-menu" type="text"
                placeholder="list comma separated dishes you usually have for lunch"
                class="form-control" ng-model="input"&gt;
        &lt;/div&gt;
        &lt;div class="form-group"&gt;
  
        &lt;button class="btn btn-default" ng-click="LunchCheckController()"&gt;
          Check If Too Much
        &lt;/button&gt;
      &lt;/div&gt;
      &lt;div class="form-group message" id="result"&gt;
          &lt;!-- Your message can go here. --&gt;
          {{stack()}}
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>This is my JavaScript</p>
  
  <pre><code>(function() { 
      'use strict';
  
      angular.module('LunchCheck', [])
             .controller('LunchCheckController', LunchCheckController);
  
      LunchCheckController.$inject = ['$scope'];
  
      function LunchCheckController ($scope) {
          $scope.input = ""; //Taking input from the user
          $scope.stack = function(input) {
              var array = input.split(',');
              if (array.length &lt; 3) {
                  return "Enjoy";
              } else {
                  return "You gotta Stop boy!";
              } // Splitting the input
          };
      }
  })();
  </code></pre>
  
  <p>I am kinda new to Angular.js. My aim is to get the string and split it. 
  After splitting I want to satisfy a situation where "If the number of items are more than 3,print enjoy" otherwise "Anything else".</p>