Browse Source

模态框html代码样式显示

hejq 8 years ago
parent
commit
6bc3db7a7b

+ 3 - 3
donate-console/src/main/webapp/resources/js/index/app.js

@@ -298,14 +298,14 @@ define([ 'angularAMD', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'file-
     /**
      * 项目详情框
      */
-    app.controller('ProjectDetailCtrl', ['$scope', 'Project', 'toaster', '$modalInstance', 'BaseService', 'id', '$modal',
-        function($scope, Project, toaster, $modalInstance, BaseService, id, $modal) {
+    app.controller('ProjectDetailCtrl', ['$scope', 'Project', 'toaster', '$modalInstance', 'BaseService', 'id', '$modal', '$sce',
+        function($scope, Project, toaster, $modalInstance, BaseService, id, $modal, $sce) {
 
         var loadData = function() {
             // 获取项目详情
             Project.getDetailById({id :id}, {}, function(data) {
                 $scope.project = data;
-                $scope.project.introduction = htmlEncode($scope.project.introduction);
+                $scope.code = $sce.trustAsHtml( $scope.project.introduction);
             }, function() {
                 toaster.pop('error', '详情加载失败');
             });

+ 1 - 1
donate-console/src/main/webapp/resources/view/project/project_detail.html

@@ -86,7 +86,7 @@
                     <div class="project-intro fl">
                         <div class="project-txt fl">
                             <div class="project-intro">
-                                <span>{{project.introduction}}</span>
+                                <div ng-bind-html="code"></div>
                                 <!--<img src="static/images/active05.png" alt=""/>-->
                             </div>
                             <!--<div class="projectIntro">-->