0
我有这个指令编译:Angularjs:在角模板中使用linky和NG绑定,HTML一起
var app = angular.module('mobApp.services');
app.directive('compile', ['$compile', function ($compile) {
return function(scope, element, attrs) {
scope.$watch(
function(scope) {
return scope.$eval(attrs.compile);
},
function(value) {
element.html(value);
$compile(element.contents())(scope);
}
);
};
}])
我在这里用它在我的模板:
<p compile="post.details | linky:'_blank'"></p>
如果数据有任何链接其渲染很好,但它不像<b>
像<b>
呈现文字。我只想<b>
作为<b>
而不使内部文字加粗。
如果我使用ng-html-bind
所有工作正常,但链接不起作用。如果我使用linky
链接工作正常,但渲染不起作用。