0

I'm trying to print a button in html passing it as a parameter in angular2 but angular2 never translate it.

modal.component.ts

this.footer = `<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>`

modal.component.html

<div class="modal-footer" [innerHTML]="footer"></div>

output html

<div class="modal-footer" ng-reflect-inner-h-t-m-l="Close">Close</div>
2
  • I think you will not be able to make the button work at all if you do it like that.. angular needs to "compile" it somehow.. Why not put it inside the div? use ngif or something ? Commented Dec 5, 2016 at 0:00
  • Maybe you're right, I have to find a way to pass the buttons of modal as a parameter so that I can adjudicate the parameters in the function that calls the modal Commented Dec 5, 2016 at 9:25

1 Answer 1

2

Should be innerHtml instead of innerHTML. It is case sensitive.

For example :

<div class="modal-footer" [innerHtml]="footer"></div>
Sign up to request clarification or add additional context in comments.

1 Comment

I tried but it does not change the result. I also forgot to mention that if I pass as a parameter "<b> body </b>" it keeps it right.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.