Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e41e445

Browse files
marclipovskypetebacondarwin
authored andcommitted
docs(guide/compiler): add fourth step on appending the compiled template to the DOM
Closes angular#5087
1 parent 7ab7319 commit e41e445

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

docs/content/guide/compiler.ngdoc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ This should help give you an idea of what Angular does internally.
190190
<pre>
191191
var $compile = ...; // injected into your code
192192
var scope = ...;
193+
var parent = ...; // DOM element where the compiled template can be appended
193194

194195
var html = '<div ng-bind="exp"></div>';
195196

@@ -200,7 +201,10 @@ This should help give you an idea of what Angular does internally.
200201
var linkFn = $compile(template);
201202

202203
// Step 3: link the compiled template with the scope.
203-
linkFn(scope);
204+
var element = linkFn(scope);
205+
206+
// Step 4: Append to DOM (optional)
207+
parent.appendChild(element);
204208
</pre>
205209

206210
### The difference between Compile and Link

0 commit comments

Comments
 (0)