AngularJS ng-include Directive
Definition and Usage
ng-include
The instruction includes HTML from an external file.
The content included will be included as a child node of the specified element.
ng-include
The value of the attribute can also be an expression, returning a filename.
By default, the included file must be located in the same domain as the document.
Example
Include HTML from an external file:
<div ng-include="'myFile.htm'"></div>
Syntax
<element ng-include="filename" onload="expression" autoscroll="expression" ></element>
ng-include
Directives can also be used as elements:
<ng-include src="filename" onload="expression" autoscroll="expression" ></ng-include>
All HTML elements support.
Parameters
Parameters | Description |
---|---|
filename | Filename, enclosed in apostrophes, or an expression that returns the filename. |
onload | Optional. The expression to be calculated when loading the included file. |
autoscroll | Optional. Whether the included part should scroll to a specific view. |