# Unknown Provider Error When Using $filter Service

**URL:** <https://forum.ionicframework.com/t/unknown-provider-error-when-using-filter-service/56785>\
**Category:** ionic-v1\
**Created:** [July 6, 2016, 6:57pm UTC](https://forum.ionicframework.com/t/unknown-provider-error-when-using-filter-service/56785 "2016-07-06T18:57:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xbg101](https://avatars.discourse-cdn.com/v4/letter/x/c37758/32.png) [@xbg101](https://forum.ionicframework.com/u/xbg101)\
**Post date:** [July 6, 2016, 6:57pm UTC](https://forum.ionicframework.com/t/unknown-provider-error-when-using-filter-service/56785/1 "2016-07-06T18:57:47Z")

</div>

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](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)
```
