title: conditional search in angular js
body: <p>I want the search box to search by name or by city based on the appropriate radio button selected. However, the list it displays will contain name-city pair. I tried <code>ng-if</code> and <code>ng-true-value</code> and <code>mg-false-value</code>, but it won't work. Any suggestions?
  Here's the code:</p>
  
  <pre><code>&lt;html ng-app="demoApp"&gt;
      &lt;head&gt;
          &lt;script type="text/javascript" src="angular.min.js"&gt;&lt;/script&gt;
      &lt;/head&gt;
      &lt;body ng-controller="DemoController"&gt;
          Search: &lt;br/&gt;
          &lt;input type="text" ng-model="name"/&gt; {{name}}
  
          &lt;br/&gt;&lt;br/&gt;
          &lt;input type="radio" ng-model="search.name" ng-value="search.name" name="search" &gt; By Name &lt;/input&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;
          &lt;input type="radio" ng-model="search.city" ng-value="search.city" name="search" &gt; By City &lt;/input&gt;
  
          &lt;ul&gt;
              &lt;li ng-repeat="friend in friends| filter:search.name:friend.name | filter:search.city:friend.city "&gt;{{friend.name}} - {{friend.city}} &lt;/li&gt;
          &lt;/ul&gt;
          &lt;script&gt;
  
          var demoApp = angular.module('demoApp',[]);
  
          demoApp.controller('DemoController', function($scope){
              $scope.friends = [
                  {name:'Akshay',city:'Hyderabad'},
                  {name:'Peeyush',city:'Madras'},
                  {name:'Aditya',city:'Mumbai'}
              ];
          });
          &lt;/script&gt; 
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>