0
<ul class="alert alert-link alert-info"
data-ng-show="messages">
<li data-ng-repeat="msg in messages" data-ng-bind-html="msg | unsafe"></li>
</ul>
控制器代码看起来如下:
...
var msg = 'You\'re logged in. The registration must ' +
+ 'be <a href="#" ' +
+ 'data-ng-click="logout(\'/ajax/logout/\', $event)">logout</a> of your profile.';
$scope.messages = [msg];
...
如何$compile
一个msg
,如果msg
来自服务器?
这是i18n消息,它存储在后端的静态文件中。 \t 您的解决方案会抛出一个错误:'错误:[$ sce:itype] ...' [** plunk **](http://plnkr.co/edit/sZARES?p=preview) (),'append()',... – romeo 2014-10-01 19:22:14
通常,停止使用指令而不是'ng-repeat': 'element.html($ compile('