AngularJS ng-include Directive


Include HTML from an external file:

<div ng-include="'myFile.htm'"></div>
Try it yourself »

Definition and Usage

The ng-include mandate incorporates HTML from an outer file.

The included substance will be incorporated as childnodes of the predefined element.

The estimation of the ng-include trait can likewise be an articulation, restoring a filename.

By default, the included document must be situated on indistinguishable area from the document.


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

The ng-incorporate order can likewise be utilized as an element:

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

Supported by all HTML elements.

Parameter Values

Value Description
filename A filename, composed with punctuations, or an articulation which restores a filename.
onload Optional. An articulation to assess when the included record is loaded.
autoscroll Optional. Regardless of whether the included segment ought to almost certainly scroll into a particular view.