javascript - AngularJS: can I use filter, defined in another module? -


i've angular project, structured using by-module-type principle:

├── directives ├── services ├── filters │   └── filters.js └── states     └── home         ├── home.html         └── home.module.js 

i've created custom filter in filters.js

import angular "angular";  export default angular.module("app.filters", [])     .filter("removestartingwithdollar", function(items) {         var filtereditems = [];         angular.foreach(items, function(item) {             if (!item.startswith('$')) { filtereditems.push(item);  }         });         return filtereditems;     }); 

i want use removestartingwithdollar filter in home.html template. how inject dependency , should @ all?

just inject app.filters module in anywhere need use provider of it.

angular.module("mysecondmodule", [app.filters]) 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -