
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
invoke-filter
Advanced tools
An optimization for calling pure functions in the template of an Angular application
An optimization for calling pure functions in the template of an Angular application
You can get this via:
npm install --save invoke-filter
Then add the dependency to your project:
var yourApp = angular.module('yourModule', [
require('invoke-filter');
]);
define(['invoke-filter'], function(invokeFilter) {
var yourApp = angular.module('yourModule', [invokeFilter]);
});
var yourApp = angular.module('yourModule', [invokeFilter]);
In your template, instead of doing this:
<div>{{vm.someFunctionOnYourController(vm.a, 'foo', vm.arg3)}}</div>
Do this:
<div>{{vm.someFunctionOnYourController | invoke:vm.a:'foo':vm.arg3}}</div>
One benefit to using filters is that as of
Angular
1.3,
all filters are considered "stateless" (ie "pure functions") by default. This means that if the inputs don't change,
then Angular wont call the filter. So if your controller function is a stateless function (returns the same output for a
given input), then you can pass it to this invoke filter and your function will only be called when the inputs change.
This is definitely a performance optimization and I recommend you make certain that you really need it. This is likely
most useful for functions that make complex computations or if you use it a lot (like in an ng-repeat).
FAQs
An optimization for calling pure functions in the template of an Angular application
We found that invoke-filter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.