Satish Junghare
Satish Junghare

Reputation: 51

Dont allow to show html tag while appending to div or span

When I am going to bind data in angularjs variable like..

$scope.msg = '<div class="success_msg">Message</div>';

<span ng-bind="msg"></span>

but its show with div tab also. I dont want to show html elements. I want to show only Message in this span. What is the solution?

Upvotes: 0

Views: 39

Answers (1)

Koen Weyn
Koen Weyn

Reputation: 1004

When you need to bind html fragments, you have to use mg-bind-html. You can find the documentation here: https://code.angularjs.org/1.2.16/docs/api/ng/directive/ngBindHtml

(don't forget to add ngSanitize to your module dependencies)

Upvotes: 1

Related Questions