1

i have a text showing in the angular.

var text = 'The Zones We are Looking for a Reversal is6000<br><br>We Will Keep Close Eyes on it <br>But Keep in Mind That if We Break Below 6000 USD<br><br>Then This Time We Expect a Hard PullBack Towards 5250-5500 USD Levels<br><br>'

<div class="text">
  {{text}}
</div>

.text {
    word-wrap: break-word;
    line-height: 150%;
    white-space: pre-wrap;
}

why on the html it is still showing the '< br >' instead of the breaking lines?

user824624
  • 7,077
  • 27
  • 106
  • 183

1 Answers1

0

Use ng-bind-html for binding with html elements too. ng-bind creates a text node. Refer for ng-bind-html You can also use the pre tag. It will automatically provide line breaks wherever specified

<div class="text">
  <pre>{{text}}</pre>
</div>
ellipsis
  • 12,049
  • 2
  • 17
  • 33