ngInclude (directive in module ng )

Description

Fetches, compiles and includes an external HTML fragment.

Keep in mind that Same Origin Policy applies to included resources (e.g. ngInclude won't work for cross-domain requests on all browsers and for file:// access on some browsers).

Usage

as element (see IE restrictions)
<ng-include
       src="{string}"
       [onload="{string}"]
       [autoscroll="{string}"]>
</ng-include>
as attribute
<ANY ng-include="{string}"
     [onload="{string}"]
     [autoscroll="{string}"]>
   ...
</ANY>
as class
<ANY class="ng-include: {string}; [onload: {string};] [autoscroll: {string};]">
   ...
</ANY>

Directive info

  • This directive creates new scope.

Parameters

Events

Example

Source











Demo