title: angularjs fetch value from textbox after clicking a button only
body: <p>This is my code</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular.min.js"&gt;&lt;/script&gt;
      &lt;script&gt;
          var myApp = angular.module('myApp', []);
          myApp.controller('myController', function ($scope) {
  
              $scope.getName = function () {
                  $scope.name = fname;
                  $scope.lastName = lastName;
              };
  
          })
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body ng-app="myApp" &gt;
      &lt;div &gt;
          &lt;input type="text" ng-model="name"/&gt; &lt;br&gt;
          &lt;input type="text" ng-model="lastName" /&gt;
      &lt;/div&gt;
      &lt;div ng-controller="myController"&gt;
          &lt;input type="button" value="click" ng-click="getName()" /&gt;
          &lt;br&gt;
          Hello FirstName {{name}}&lt;br&gt;
          Last Name {{lastName}}
  
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>values are coming while typing into textbox but i want values only after clicking the button.Please help me.<br>
    I tried in both ways simple as well as by using service or factory method but no success </p>