Angular Includes

AngularJS provides a way to include other external HTML fragments in our pages. The ngInclude directive allows the fragmentation and reuse of the application layout and is an important concept to explore.

HTML does not support embedding external html pages. It can be achieved in the following ways.

AjaxThe most common way is to use an http request (AJAX) to get the corresponding html page and set it in innerHTML of an html element.
Server Side IncludesJSP, PHP and other web side server technologies can include html pages within a dynamic page.

The following is an example code for the usage of the ngInclude directive:
<div ng-include="'menu.html'"></div>
<div class="container">
<div ng-include="'menu.htm'"></div>
<div ng-include="'employee_Form.htm'"></div>
Related Tutorial
Follow Us #