Embed external HTML page into AngularJS

embed external html pages

You can embed external HTML pages into AngularJS. The most common way, is to use an ajax request to fetch data from the server, and then put the data to the innerHTML of an HTML element.

Basically, ng-include fetches then compiles and includes an external HTML fragment.

<ng-include
src="string" [onload="string"] [autoscroll="string"]>  


</ng-include>

Directive Info:
– This directive creates new scope.
– This directive executes at priority level 400.

Embed external HTML pages:

<div class="container">
<div ng-include="'firstpage.htm'"></div>
<div ng-include="'secondpage.htm'"></div>
</div>

For ngInclude references click here.

Leave a Reply

Your email address will not be published. Required fields are marked *