title: Getting the value of ng-model input from controller angular js
body: <p>I'm trying to get the value of my ng-model input to my controller. The input value has a value and not empty. 
  Why this code is not working? It says undefined when you alert or console log. What did i missed? really appreciate your help. here is my code</p>
  
  <p>input --> the value is 1</p>
  
  <pre><code>    &lt;input type="text" name="idval" ng-model="Data.idval"&gt; 
  </code></pre>
  
  <p>js</p>
  
  <pre><code>app.controller('Controller', function($scope, $http){
  
  $scope.fetchvalue = function(){
  
    var id = $scope.Data.idval; // not working
    var id = $scope.idval; // even this one
  
    alert(id); // its undefined
  
      $http.post(
          "query.php", {
              'ID': id,
          }
      ).then(function(response) {
  
         console.log(response.data);
  
      });
  }});
  </code></pre>