Javatpoint Logo
Javatpoint Logo

AngularJS ng-include Directive

The AngularJS ng-include directive is used to fetch, compile and include an external HTML fragment. These are added as childnodes of the specified element. The ng-include attribute's value can also be an expression, returning a filename.

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

It is supported by all HTML elements.

Syntax:

It can also be used as an element:

Parameter explanation:

filename: It specifies a filename, written with apostrophes, or an expression which returns a filename.

onload: It is optional. It specifies an expression to evaluate when the included file is loaded.

autoscroll: It is also optional. It specifies whether or not the included section should be able to scroll into a specific view.

Let's take an example to demonstrate the ng-include directive.

See this example:

Test it Now



Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA