Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I read a few tutorials on this subject. here is a basic filter: Building Custom AngularJS Filters | Scotch[^]
and here is a filter with a dependency: angularjs - How to inject a service as dependency for a custom filter in angular.js? - Stack Overflow[^]


I get a similar error with every attempt:
Unknown provider: selectorOpsProvider <- selectorOps <- selectorFilterFilter

can anyone out there see where I'm going wrong?

Thanks ^_^
Andy

What I have tried:

( I'll have to get used to a new format.)


This is my attempt to implement the examples given:
JavaScript
masterApp.filter('selectorFilter', function (selectorOps) {
       return function (input) {
           return selectorOps[input];
       }
   }).filter('adjustmentFilter', function (adjustmentOps) {
       return function (input) {
           return adjustmentOps[input];
       }
   }).controller('rulesetCatalogueCtrl', [
       '$scope', '$sce', 'selectorFilter', 'adjustmentFilter', function ($scope, $sce, selectorFilter, adjustmentFilter) {

           $scope.asSelectorOp = null;
           $scope.asAdjustmentOp = null;

           $scope.rateHub.run("getSelectorOps").then(function (data) {
               $scope.asSelectorOp = selectorFilter(data);
           });
           $scope.rateHub.run("getAdjustmentOps").then(function (data) {
               $scope.asAdjustmentOp = adjustmentFilter(data);
           });

           ...

       }]);
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900