title: Get input value in a variable in Angularjs before submit to call a webapi
body: <p>I would like to access the input field value inside a variable that could be used in AngularJS so that I could add it to a string with the help of which I could call a rest api.</p>
  
  <p>kindly help.</p>
  
  <pre><code>&lt;body ng-app="myApp"&gt;
     &lt;div ng-controller="myCtr"&gt;
         &lt;form  name="myForm"&gt;
             &lt;input type="text" ng-model='pinCode'  id="zip" onBlur="myZipcode"&gt;
             {{city}}
             {{state}}
         &lt;/form&gt;
    &lt;/div&gt;
    &lt;script&gt;
      var zip;
      var pat1;
        function myZipcode(){
             zip = document.getElementById("zip").value;
             pat1 = 'http://ziptasticapi.com/'+zip;   
        }
      var myApp = angular.module('myApp' , []);
      myApp.controller('myCtr', function($scope, $http){
          var path = 'http://ziptasticapi.com/12345'  
          $http.get(pat1).success(function (response) {
          $scope.city = response.city;
          $scope.state = response.state;});    
      });
    &lt;/script&gt; 
  &lt;/body&gt;
  </code></pre>
  
  <p>Here in http.get service if I use path variable instead of pat1 it works.
  Another thing that I want the state and city to come dynamically without the form to be submitted and to be called from an REST API. That is why I am trying to get the input value inside a variable to accomplish the task</p>