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.

MethodDescription
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>
snippet
<body>
<div class="container">
<div ng-include="'menu.htm'"></div>
<div ng-include="'employee_Form.htm'"></div>
</div>
</body>
Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents +