用angular.element实现jquery的一些功能的简单示例

下面实现了在每个p元素后面自动添加hello world.

在这里我要说的是jquery中的 $document.ready()相当于angualr 中的angualr.element(document).ready(callback).

例子代码如下

<!DOCTYPE html>
<html >
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script src="../materialDesignfile/angular.min.js"></script>
    <script>
        function xiu() {
                angular.element(document).ready(function () {
                //every p element append hello world.
                angular.element(document).find("p").append("helllo world");
            });
        };
    </script>
    <button onclick="xiu()">append</button>
<p>china</p>
</body>
</html>