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>