Tutorial 16 – how to use ng-include in Angularjs

How to use ng-include in Angularjs?
Directive ng-include in Angularjs.
This sample will help you know about using ng-include in AngularJS.
We assume that we have two html files template-a.html and template-b.html

 <html>  
   <head>  
     <title>Angular JS Model</title>  
     <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script>  
     <script>  
       angular.module('MyForm', [])  
           .controller('myController', ['$scope', function($scope) {  
            }]);  
     </script>  
   </head>  
   <body ng-app="MyForm">  
 @*Directive ng-include in Angularjs  
             *@  
           <div ng-include src=" '/template-a.html' "></div>  
           <div ng-include src=" '/template-b.html' "></div>  
 </body>  
  </html>  


1 comment:

Popular Posts