In this tutorial, we will learn to load a html page inside another html page, to do that we usually go for HTML iframe tag in which we can either set HTML file path or any URL from different domain in src attribute.
But 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.
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.
In HTML side:
// A configuration object defining how our directive will work
restrict: 'E', // this defines as the type of directive (E for Element)
templareUrl: 'AddUser.html' // URL of the HTML page