I have the following code that adds html to a variable. However, when it get's shown on the page, the link doesn't work.
What's the best way to get a ui-sref
link to work when inserting it dynamically?
JAVASCRIPT
.controller('page', function($scope, $rootScope, $http, $state, $sce) {
$scope.message = $sce.trustAsHtml('A <a ui-sref="login">login</a> link');
})
HTML
<div ng-bind-html="message"></div>
$compile
-$sce.trustAsHtml($compile('A <a ui-sref="login">login</a> link')($scope));
– Pule