AngularJS ng-includeDirective

AngularJS 参考手册AngularJS Reference Manual


AngularJS Examples

Include HTML file:

<div ng-include="'myFile.htm'"></div>

Try it Yourself »

Definition and Usage

ng-includeThe directive is used to include external HTML files.

The included content will be treated as child nodes of the specified element.

ng-includeThe value of the attribute can be an expression that returns a file name.

By default, the included file must be under the same domain name.


Syntax

<element ng-include="filename" onload="expression" autoscroll="expression" ></element>

The ng-include directive used as an element:

<ng-include src="filename" onload="expression" autoscroll="expression" ></ng-include>

All HTML elements support this directive.


Parameter Values

Value Description
filename File name. You can use an expression to return the file name.
onload Optional. An expression executed after the file is loaded.
autoscroll Optional. Whether the included part is scrollable in the specified view.

AngularJS 参考手册AngularJS Reference Manual