AngularJS: Apply filter to template
<p>I created a simple filter to format a number based on the current locale.</p>

<pre><code>angular.module('myApp').filter('doubleFilter', DoubleFilter);

function DoubleFilter($translate) {
    return function(val, decimalPlaces) {
        if (val &amp;&amp; (typeof val === 'number')) {
            val = val.toFixed(decimalPlaces);
            if ($translate.use() === 'de_DE') {
                val = val.replace('.', ',');
            }
        }
        return val;
    }

};
</code></pre>

<p>I call this filter in my template like this and it works fine:</p>

<pre><code>{{dog.weight | doubleFilter : 2}}
</code></pre>

<p>However when I change the language using $translate.use('en_US') the format of the numbers in my template are not updated. Obviously I am missing out on something here.</p>

<p>How can I update the view when the language changes?</p>