<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>angular.element</title> </head> <body> <h1>angular.element</h1> <p> <span>描述:</span><br /> <span>包裹着一部分dom元素或者HTML字符串,把他做爲一個jquery元素來處理。</span> </p> <p> <span>使用方法:</span><br /> <span>angular.element(element)</span> </p> <p> <span>參數:</span><br /> <span>element: String||DOMstring,html字符串或者dom元素。</span><br /> </p> <p> <span>返回值:</span><br /> <span>jquery對象</span> </p> <hr /> <div id="test"> 使用HTML做爲字符串參數:<input type="button" onclick="button1()" value="button1"/><br /> 使用DOM元素:<input type="button" onclick="button2()" value="button2"/> </div> </body> <script src="../../js/angular.1.3.0.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript"> function button1(){ //使用HTML字符串做爲參數 console.log(angular.element('<div id="test">element測試</div>').html()) }; function button2(){ //使用dom元素做爲參數 var dom = document.getElementById('test'); console.log(angular.element(dom).html()) } </script> </html>