You can use one form of one-time binding. There are several options:
There are several differences from four (not related to your question):
- bind-once is the most popular one that sees the most active development. Two instructions are required to complete the task (
bindonce and bo-* ). - angular -once is a minimalist of four (don't quote me on this).
- guard fighters do not process the promised data.
- fast-bind has a notification system for semi-static bindings using the event bus in Angular.
Assuming you start using one of them, your bindings might look something like this:
<div bindonce="someData"> <span bo-bind="someData.text | yourFilter"></span> </div>
<span once-text="someData.text | yourFilter"></span>
<span set-text="someData.text | yourFilter"></span>
<span bind-once="someData.text | yourFilter"></span>
This way your filters will not overestimate Angular calls to $digest . If you filter the collection in your view ( <li ng-repeat="coll | filter"></div> ), I suggest you move these filters to the controller to reduce the number of calls to the filters themselves.
source share