title: angularjs $scope.watch text field error?
body: <p>i have used local storage to filter listpage .i have text box with clear button
  when i clear button its not working becoze of that $scope.watch.if i enter values in text box also $scope.watch is not allowed the values how to avoid this error when i click clear button.when i clear or ng-model changes i need to pick current value based on that value list should come</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>.controller('ListingCtrl', [
      '$scope', '$http', '$location', '$window', '$filter','$ionicPopover','$ionicLoading',
      function($scope, $http, $location, $window, $filter, $ionicPopover, $ionicLoading) {
   $scope.$watch(function() {
      var searchstore =window.localStorage.getItem("searchstore");
      console.log(searchstore);
      $scope.query=searchstore;
     })
   $scope.clearSearch = function() 
   {
     $scope.query = '';
   };
   $http.get('*****').success(function(data,dealers,response)
     {  
     $scope.dealers = data;
     
     });
  }])
     
  
  &lt;!-- begin snippet: js hide: false --&gt;</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="bar bar-header item-input-inset"&gt;
    &lt;label class="item-input-wrapper" &gt;
      &lt;i class="icon ion-ios-search placeholder-icon"&gt;&lt;/i&gt;
      &lt;input type="text" placeholder="Search" ng-model="query" &gt;
    &lt;/label&gt;
   &lt;button class="button button-icon ion-ios-close-outline"     ng-click="clearSearch()" id="iconcolor"  &gt;clear&lt;/button&gt;
  &lt;/div&gt;
  &lt;div class="list card" data-ng-init="nearme()" data-ng-repeat="dealer in dealers |  filter:query "&gt;
       &lt;div class="item item-thumbnail-left item-icon-right" href="#"&gt;
        &lt;h2&gt;{{dealer.Store_Name}}&lt;/h2&gt; 
        &lt;p&gt;{{dealer.S_Address.area}} {{dealer.S_Address.city}}&lt;/p&gt; 
     &lt;p&gt;{{dealer.S_Services}}&lt;/p&gt;
    &lt;/div&gt; 
    
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>