NoStressDeveloper
NoStressDeveloper

Reputation: 533

How to concatanate html links and display them in div

In js file i have

 vm.text= response.children.map(function (e) {
                                        var html = '<a ng-click="hello">' +  e.number+ '</a>';
                                        return html;
                                    }).join('  ||  ');

In html i have

 <div>
                  <strong> {{vm.text}}</strong>
            </div>

Above div display <a ng-click="hello">9253</a> || <a ng-click="hello">1025</a>

instead of just numbers w a hyperlink. I am guessing {{}} won't allow html. How do i make it not do it and display links?

Upvotes: 0

Views: 38

Answers (1)

dxlliv
dxlliv

Reputation: 482

Try with <strong [innerHTML]="vm.text"></strong>.

Edit: I didn't notice the ng- prefix, you should use ng-bind-html instead.

Upvotes: 2

Related Questions