结构-行为-样式-Angularjs-ngSanitize

时间:2023-12-22 11:06:08

简单点,上代码:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>ngSanitize</title>
<script src="../jquery.1.9.1.min.js"></script>
<script src="../angular.js"></script>
<script src="angular-sanitize.js"></script>
</head>
<body ng-app="myApp" ng-controller="myCtrl">
    <div class="container">
        <div class="row" ng-bind-html="content"></div>
    </div>
    <script>
        var app = angular.module('myApp',['ngSanitize']);
        app.controller('myCtrl',['$scope',function($scope){
            $scope.content = "<ul><li>小明</li><li>李雷</li><li>露西</li><li>海尔</li></ul>";
        }]);
    </script>
</body>
</html>