How to load a html page inside another html page in AngularJS

Posted by Sumeet Arora
6
Jul 28, 2015
192 Views
Image To load a html page inside another html page we usually go forhtml iframe tag in which we can either set HTML file path or any URL from different domain in src attribute. Ex.
<iframe src="http://findnerd.com"></iframe>
In AngularJS we can do that by using ng-include directive, where we can give the path of our HTML page and in will be rendered within the HTML page. Ex.
 <div ng-include="'myPage.html'"></div>

Here ng-include is expecting variable with the name of the file to include. To pass the name directly as a string, we use single quotes (' . . . ').

We can also create the custom directive which allows us to write HTML that expresses the behavior of our application, where as HTML only defines us the structure of the page.

These Directives can also be used as :
Expressing complex UI.
Calling events and registering event handlers.
Reusing the common components.

To view the full article about how to load a html page inside another html page in AngularJS  Visit FindNerd.
FindNerd is providing programming queries solutions. Visit us to post your query of android, php, java, c,Javascript programming questions and answers etc., on ask question and get instant solution.

Comments
avatar
Please sign in to add comment.