JSON to HTML with separator lines, angular translate
I am using Angular-translator and I am trying to load text from JSON using breakline but html is not recognizing.
JSON:
"ABOUT": {
"headline":"Every day\n every moment",
"span": "Be Like"
}
ANGULARJS:
.config(function($translateProvider) {
// Sanitize
$translateProvider.useSanitizeValueStrategy('escaped');
// Load JSON
$translateProvider.useStaticFilesLoader({
prefix: '/app/languages/app-',
suffix: '.json'
});
$translateProvider.preferredLanguage('en');
HTML:
<h2> <span>{{ 'ABOUT.span' | translate }}</span>
{{ 'ABOUT.headline' | translate }}
....
Is there a way to do this?
+3
source to share
1 answer
Use white-space:pre;
in css
so that it is like in your html
<h2 style="white-space:pre;"> <span>{{ 'ABOUT.span' | translate }}</span>{{ 'ABOUT.headline' | translate }} </h2>
here is the plunker http://plnkr.co/edit/Bjs6LC9Z9Fy1v5ULqlVW?p=preview
+3
source to share