2 Temmuz 2013, Salı
açısal ng-bind-html-güvensiz ve Yönerge içinde
Bunun için html bağlamak istediğim bir unsur var.
<div ng-bind-html-unsafe="details" upper></div>
O çalışır. Şimdi, onunla birlikte ben de bağlı html bağlı bir Direktif var:
$scope.details = 'Success! <a href="#/details/12" upper>details</a>'
Ama div ile Direktif upper ve çapa değerlendirin. Nasıl başaracağım?
CEVAP
2 Temmuz 2013, Salı
Ayrıca bu sorun ile karşı karşıya kaldım ve saat internet arama yaptıktan sonra @çözüm olduğunu kanıtladı Chandermani yorum okudum. Bir araman lazım 'derleme' bu model ile: Yönerge
HTML:
<div compile="details"></div>
JS:
.directive('compile', ['$compile', function ($compile) {
return function(scope, element, attrs) {
scope.$watch(
function(scope) {
// watch the 'compile' expression for changes
return scope.$eval(attrs.compile);
},
function(value) {
// when the 'compile' expression changes
// assign it into the current DOM
element.html(value);
// compile the new DOM and link it to the current
// scope.
// NOTE: we only compile .childNodes so that
// we don't get into infinite loop compiling ourselves
$compile(element.contents())(scope);
}
);
};
}])
Bir çalışma fiddle of it here görebilirsiniz
Bunu PaylaÅŸ:

Nasıl $Sony kullanıyorsunuz.çoğaltmak ...
Ng-bind-html-güvensiz kaldırılmış, HTM...
Nasıl TextView içinde HTML görüntüleme...
Bir HTML dosyası içinde bir HTML dosya...
Nasıl özel bir yönerge içinde değerlen...