विश्व का सबसे बड़ा हिंदी वेब डेवलपर साइट

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 directive includes HTML from an external file.

The included content will be included as childnodes of the specified element.

The value of the ng-include attribute can also be an expression, returning a filename.

By default, the included file must be located on the same domain as the document.


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

The ng-include directive can also be used as an element:

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

Supported by all HTML elements.

Parameter Values

Value Description
filename A filename, written with apostrophes, or an expression which returns a filename.
onload Optional. An expression to evaluate when the included file is loaded.
autoscroll Optional. Whether or not the included section should be able to scroll into a specific view.