diff options
| author | Igor Minar | 2010-11-24 19:14:34 -0800 | 
|---|---|---|
| committer | Igor Minar | 2010-11-24 19:14:34 -0800 | 
| commit | 4fc3ee80407828ba1fe983a45385a41bca32131c (patch) | |
| tree | de075312fc79ee02aea6a4e1109c95cb8252e375 /src | |
| parent | 39d3ae80d9310cd50457970efd05ed2a9bf78053 (diff) | |
| download | angular.js-4fc3ee80407828ba1fe983a45385a41bca32131c.tar.bz2 | |
docs for angular.compile
Diffstat (limited to 'src')
| -rw-r--r-- | src/Angular.js | 25 | 
1 files changed, 23 insertions, 2 deletions
diff --git a/src/Angular.js b/src/Angular.js index 9dddaded..cc85f927 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -1022,10 +1022,31 @@ function merge(src, dst) {    }  } -function compile(element, existingScope) { + +/** + * @workInProgress + * @ngdoc function + * @name angular.compile + * @function + * + * @description + * Compiles a piece of HTML or DOM into a {@link angular.scope scope} object. +   <pre> +    var scope1 = angular.compile(window.document); +    scope1.$init(); + +    var scope2 = angular.compile('<div ng:click="clicked = true">click me</div>'); +    scope2.$init(); +   </pre> + * + * @param {string|DOMElement} element Element to compile. + * @param {Object} parentScope Scope to become the parent scope of the newly compiled scope. + * @returns {Object} Compiled scope object. + */ +function compile(element, parentScope) {    var compiler = new Compiler(angularTextMarkup, angularAttrMarkup, angularDirective, angularWidget),        $element = jqLite(element); -  return compiler.compile($element)($element, existingScope); +  return compiler.compile($element)($element, parentScope);  }  /////////////////////////////////////////////////  | 
