Could you explain the discrepancies between:
A: {{ variable | filter }}
and
B: {{ 'static string' | filter }}
I have a few questions regarding this:
- Are both considered interpolations or just
A
? - Does
A
utilize$interpolate
, whileB
utilizes$parse
? (based on another insightful discussion found on Stack Overflow) - How do these two methods differ in terms of performance? With
A
, every time the value ofvariable
changes, the template gets updated as it listens for changes. If there are multiple interpolations likeA
, could this lead to performance issues due to extensive model listening? DoesB
handle this differently? Specifically, I am considering implementing Angular Translate, which makes use of thetranslate
filter. It involves a global variable that stores the current language used in the interface; when the language changes, allB
interpolations with thetranslate
filter update. But how does this mechanism work internally? What is being monitored and by whom? Is there only one listener for changes in the language variable (stored in Angular config) that facilitates updating multiple i18n-labels on language alterations? Or are there several listeners involved? If I were to include 500
interpolations, would this potentially impact application speed due to excessive listening?{{ 'static string' | translate }}
If any of my assumptions are incorrect, kindly advise.