0

When I try to display an anchor within an input field? I tried the below code but the compiled html does not display. It just displays the html with vm.url as it is.

HTML template:

<td class="md"><input type="text" value="{{vm.getUrl()}}" size="60"></input></td>

Controller code

    vm.url = '<a href="https://bankofamerica.com">https://bankofamerica.com</a>';
 vm.getUrl = function(){
                return vm.url;
 }
neelmeg
  • 2,459
  • 6
  • 34
  • 46
  • do you want it to be an active a tag or just show the url? if you just want the url i recommend looking at this [SO](http://stackoverflow.com/a/6959769/4812515) answer. – alphapilgrim Nov 22 '16 at 18:43
  • want an active anchor tag to display in the input text field so that its clickable too. – neelmeg Nov 22 '16 at 19:30
  • As per this answer looks like it wont be possible? http://stackoverflow.com/questions/21077208/is-it-possible-to-place-a-link-inside-input-field?noredirect=1&lq=1 – neelmeg Nov 22 '16 at 19:38
  • yeah, best bet is to use a label and finesse the CSS accordingly. – alphapilgrim Nov 22 '16 at 19:40

1 Answers1

0

Can you break it up like below? You can't pass html that was perhaps you can look at tranclude.

HTML:

<td class="md"><input type="text" size="60"></input>
<a href={{vm.url}}> <!-- can't remember if you need the quotes. -->
    {{vm.url}}
</a>
</td>

JS:

vm.url = 'https://bankofamerica.com';
Mickers
  • 1,367
  • 1
  • 20
  • 28