这些是我的自定义指令,用于读取更多和to_trusted(用于转换为html)。
psp.directive('hmRead', function () {
return {
restrict:'AE',
scope:{
hmtext : '@',
hmlimit : '@',
hmfulltext:'@',
hmMoreText:'@',
hmLessText:'@',
hmMoreClass:'@',
hmLessClass:'@'
},
templateUrl: 'partials/common/read-more.html',
controller : function($scope){
$scope.toggleValue=function(){
if($scope.hmfulltext == true)
$scope.hmfulltext=false;
else if($scope.hmfulltext == false)
$scope.hmfulltext=true;
else
$scope.hmfulltext=true;
}
}
};
});
psp.filter('to_trusted', ['$sce', function($sce){
return function(text) {
return $sce.trustAsHtml(text);
};
}]);
用html调用。
如果iI删除ng-bind-html,那么阅读更多内容工作正常,但ng-bind-html指令readmore指令无效。