title: Change $scope variable value in angularJs
body: <p>I have three buttons here wish to make <code>$scope. -&gt; q &lt;-</code> <code>q</code> as variable. How can I achieve that. This is just a test code my actual problem is based on making <code>q</code> as variable so please do not suggest any workaround</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var app = angular.module('myApp', []);
  app.controller('myCtrl', function($scope) {
      $scope.name = function(q){
      $scope.a = "John Doe "; // $scope.q how to make q varibale
      }
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"&gt;&lt;/script&gt;
  &lt;div ng-app="myApp" ng-controller="myCtrl"&gt;
  Name: &lt;button ng-click="name('a')" ng-model="name"&gt;this is a&lt;/button&gt;
  &lt;button ng-click="name('b')" ng-model="name"&gt;this is b&lt;/button&gt;
  &lt;button ng-click="name('c')" ng-model="name"&gt;this is c&lt;/button&gt;
  {{a}} via a&lt;br&gt;
  {{b}} via b&lt;br&gt;
  {{c}} via c&lt;br&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>