AngularJS ng-include Instruction
AngularJS Examples
Include an HTML file:
<
div
ng-include=
"'myFile.htm'"
<
/div
Try it »
Definition and Usage
ng-include The directive is used to include external HTML files.
The included content will be a child node of the specified element.
ng-include The value of the attribute can be an expression that returns a filename.
By default, the included file needs to be on the same domain.
Syntax
<
element
ng-include=
"filename"
onload=
"expression"
autoscroll=
"expression"
<
/element
Using the ng-include directive as an element:
<
ng-include
src=
"filename"
onload=
"expression"
autoscroll=
"expression"
<
/ng-include
All HTML elements support this directive.
Parameter value
| Value | Description |
|---|---|
| filename | The filename, which can be returned using an expression. |
| onload | Optional, an expression to execute after the file is loaded. |
| autoscroll | Optional, whether the included section is scrollable in the specified view. |
AngularJS Reference Manual