我有以下代码,将html添加到变量中。但是,当它显示在页面上时,链接无法正常工作。
插入动态内容并使
插入动态内容并使
ui-sref
链接正常工作的最佳方法是什么?
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));
- tymeJV