Reputation: 299
I have a big angular app. How to translate variables, without change DOM elmenets?
Eg:
<div data-ng-bind="{{ hello }}"></div>
I dont want to edit this HTML, but I would like to hello variable. No filter, no any change. Changes made by only js side.
Upvotes: 0
Views: 109
Reputation: 36
You need to create a decorator to compile state.
Use the $provide.decorator function to change normal interpolation method.
$provide.decorator( "$interpolate", ... );
More information: https://docs.angularjs.org/api/auto/service/$provide#decorator
Upvotes: 0
Reputation: 5822
If you mean adding localization and multi-language support, there are plenty of libraries to help you out. Take a look at ng-i18next.
Upvotes: 1