Objectives and outcomes

In this tutorial we are going to learn about AngularJS Include. Well HTML does not have the capability to embed another html page within itself. This purpose is server by angular-js using ng-include directive. Using ng-include we can embed other html pages in a single html page this also serves the angular-js single page application purpose. Below is the code for the same:



HTML

<html>
<head>
<meta charset="utf-8">
<script src="angular-1.4.6/angular.min.js">
</script>
</head>
<body>
<div ng-app="">
<div ng-include="'note.html'">
</div> 
</div>
</body>
</html>


HTML code for note.html

<p>
<b>Note:</b> for ng-include to work properly we need to run the application on a server even if it is html extension page because when you run html pages without the server the url is of <b>file:///c://</b> form. ng-include does not work on such type of url. Both the pages should be present at same destination otherwise provide the full path for the page which you are including.</p> 




The above note is coming from another file