title: Angular: change data on ng-repeat with filter function
body: <p>How to change object's attribute's values on a <code>ng-repeat</code> loop using a filter function? </p>
  
  <p>My project is a shopping cart that list products depending on the view and I have an argument 'discount' which will cut 50% off the price of the product and I wish to apply the change using a filter on the <code>ng-repeat</code>. </p>
  
  <p>My data structure is : </p>
  
  <pre><code>[{  
      "categorie": "",
      "name": "",   
      "price": 12
  }]
  </code></pre>
  
  <p>My <code>ng-repeat</code> loop looks like:</p>
  
  <pre><code>ng-repeat product in products |filter:'priceFilter()
  </code></pre>
  
  <p>and my function defined inside the controller is: </p>
  
  <pre><code>var priceFilter = function(product){
      var filtered = [];
      if (discount == true) {
          for (var i = 0; i&lt; product.length; i++) {
              product.price = prix.price /2;
              filtered.push(product);
          }
      }
      return filtered;
  }
  </code></pre>
  
  <p>What am I missing? Right now it filters out all the results, sending back nothing.</p>