przemo_li
przemo_li

Reputation: 4053

Angularjs ng-bind-html resize button to fit content size?

Given list of texts with some FontAwesome icons, my controller need to pass that to template, and render each into button.

Example text:

'<i class="fa fa-hourglass fa-fw">Postpone'

My code:

<button ng-repeat="text in texts" type="button">[[text]]</button>

However it wont work as expected.

What else can be done here?

Upvotes: 0

Views: 319

Answers (1)

przemo_li
przemo_li

Reputation: 4053

<i> tag is not closed properly, which will result in browser and/or $sanitize closing </i> at the end of text. <i> with some text in it still have size of font awesome, ng-bind-html nor button will know about text.

Valid example:

'<i class="fa fa-hourglass fa-fw"></i>Postpone'

Upvotes: 0

Related Questions