Arjay Arjay -4 years ago 186
HTML Question

Angular Javascript Concatenation

Good day!

I am trying to concatenate an HTML tag to my return message but it seems that it doesn't work for me.

My controller code (if API returns that the account does not exist - screenshot):

$scope.posts = 'No account found.' + '<a href="">Apply now</a>';

And the output is:

html view

Thanks in advance!

Answer Source

You can accomplish what you would ngBindHtml. However, I would recommend reviewing what it is you are doing and considering whether it might not be better achieved by taking that markup and putting it in an ng-hide wrapped element that only shows when no account is found.

PS- it is customary to include your code as text, rather than as an image. That way it is easier to copy/paste it into the solution for clearer examples. Welcome to StackOverflow-- happy coding!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download