I use great library angucomplete-alt. Under the hood it creates input
. I want to translate this input placeholder.
In my app I use anular-translate for translation. This library uses translate
filter. For regular placeholder I can just use
<input placeholder="{{MY-KEY | translate}}">
But here I have directive that takes attributes and pass then to input
.
<angucomplete-alt id="ex1"
placeholder="{{MY-KEY | translate}}"/>
So I need to pass expression not its result as I need ability to change language time to time and each time translate filter will be called
How can I pass a such value?
angucomplete-alt
(as well as any other sensible directive) uses data bindings to translate attributes to child element. This means that interpolated "{{MY-KEY | translate}}"
value will be assigned to input
's placeholder attribute every time MY-KEY
changes. It will surely won't work if the behaviour translate
filter was changed but MY-KEY
wasn't.
After the language for translate
filter had been switched, do $rootScope.$apply()
.