title: Uncaught TypeError: Cannot read property 'filter' of undefined
body: <p>My custom filter is giving me an error.</p>
  
  <p>Uncaught TypeError: Cannot read property 'filter' of undefined</p>
  
  <p>code : </p>
  
  <pre><code>angular.module('PatientApp', []).filter('ageFilter', function() {
       // birthday is a date
       function calculateAge(birthday) { 
           var dateOut = new Date(birthday);
           dateOut.setDate(dateOut.getDate() + 1);
           var ageDifMs = Date.now() - dateOut .getTime();
           // miliseconds from epoch
           var ageDate = new Date(ageDifMs); 
           return Math.abs(ageDate.getUTCFullYear() - 1970);
       }
       return function(birthdate) { 
             return calculateAge(birthdate);
       }; 
  });
  </code></pre>