angularjs - 富文本编辑器simditor - 上传、显示带格式文本

angularjs版本 1.6.9

simditor下载地址https://github.com/mycolorway/simditor/releases  点击打开链接

加入

<link rel="stylesheet" href="../css/simditor.css" />
<link rel="stylesheet" href="../css/font-awesome.css" />

<script src="../js/simditor-all.js"></script>

<script src="../js/angular-editor.js"></script>

只需一行

<div  row=6 simditor ng-model="news.news_text"></div>

 显示页面:

<div class="col-sm-10">
    <p ng-bind-html = "htmlStr "></p>

</div>


js部分:

<script>
var app = angular.module('showApp', [ 'ngCookies']);
app.controller('detailsCtrl', function($scope, $cookieStore, $window,$sce,
$http) {
$scope.news = {};
$scope.logMesg = "";
$scope.news_id = $cookieStore.get("news_id");
$http.get(
'/fgweb/news/selOneNews.do',{
params : {
"news_id" : $scope.news_id
}
}).then(function(data){
if (data == "") {
$scope.logMesg = "得不到id";
return;
} else {
$scope.news = data.data;
$scope.htmlStr =$sce.trustAsHtml($scope.news.news_text);
console.log($scope.news);
}
}).catch(function(data){
console.log('请求失败了');
});

});
</script>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值