Unknown Provider Error When Using $filter Service

I’m creating a hybrid app using the Ionic framework, and I set up a factory to hold an array of objects. I wanted to use the $filter service to grab an object within the array that has a certain ID. This is the code I have right now. I got the idea for this implementation from this stack overflow question: http://stackoverflow.com/questions/15610501/in-angular-i-need-to-search-objects-in-an-array.

angular.module('prototype.services', [])

.factory('Patients', function($filter) {

var currentID;
var currentPatient = $filter('patientFilter')(patients, {id: currentID}, true);

var patients = [{
id: 1,
name: 'Alexander Hamilton'

return {

all:function() {
    return patients;

add: function(patient) {
    patients.push( {
        name: patient.name

setID: function(id) {
    currentID = id;

getID: function() {
    return currentID;    



From what I understand, this should work since I injected $filter into the factory I created. I’m pretty new to angular so there may be something obvious that I’m missing.

Full error was :

ionic.bundle.js:26794 Error: [$injector:unpr] Unknown provider:     patientFilterFilterProvider <- patientFilterFilter <- Patients
http://errors.angularjs.org/1.5.3/$injector/unpr?    p0=patientFilterFilterProvider%20%3C-%20patientFilterFilter%20%3C-%20Patients
at ionic.bundle.js:13438
at ionic.bundle.js:17788
at Object.getService [as get] (ionic.bundle.js:17941)
at ionic.bundle.js:17793
at Object.getService [as get] (ionic.bundle.js:17941)
at ionic.bundle.js:32697
at Object.<anonymous> (services.js:6)
at Object.invoke (ionic.bundle.js:17995)
at Object.enforcedReturnValue [as $get] (ionic.bundle.js:17834)
at Object.invoke (ionic.bundle.js:17995)