title: AngularJS: single word input validation
body: <p>I have following code:</p>
  
  <p><strong>Javascript code</strong></p>
  
  <pre><code>&lt;script&gt;
      angular.module('myApp', [])
          .config(function ($interpolateProvider) {$interpolateProvider.startSymbol('{[{').endSymbol('}]}')})
          .controller('myCtrl', function ($scope, $http) {
              $scope.word = '';
              $scope.resp = {};
              $scope.warning = '';
              $scope.get = function () {
                  if($scope.word.$invalid){
                      $scope.warning = "Please write single word";
                  }else {
                      $http.get("localhost/" + $scope.word)
                              .then(function (response) {
                                  $scope.resp = response.data;
                              });
                  }
              }
          });
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>Html code</strong>        </p>
  
  <pre><code>&lt;div ng-app="myApp" ng-controller="myCtrl" &gt;
      &lt;div ng-show="word.$invalid" class="alert alert-warning"&gt;
          &lt;strong&gt;Warning!&lt;/strong&gt; {[{warning}]}.
      &lt;/div&gt;
      &lt;input  id="filter_input" type="text" ng-model="word" ng-pattern="^[a-zA-Z]*$"/&gt;
      &lt;br/&gt;
      &lt;input id="btn" type="button" ng-click="get()" value="Check Level"&gt;
      &lt;br/&gt;
      &lt;label style="text-align: center"&gt;{[{resp.level}]}&lt;/label&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I would like to show warning message, when user fill in input with more than one word. Could you please assist.</p>