AngularJS ng-include directory example

ng-copy
The ng-include directive is used to load other url (page) content in the current page.

Example

URL
/



You can change the above text value to any of the following page to test the functionality.
activemembers.aspx
rss.xml

<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <style type="text/css"> .smplprv { padding: 10px; border: solid 1px #ccc; } </style> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.16/angular.min.js"></script> </head> <body> <div ng-app="myApp" ng-controller="myCntrl"> URL<br /> /<input type="text" ng-model="sampleurl" /> <br /> <br /> <div ng-include="includeurl()" ng-class="{smplprv:true}"> </div> </div> <script language="javascript"> var myapp = angular.module("myApp", []); myapp.controller("myCntrl", function ($scope) { $scope.sampleurl = "privacypolicy"; $scope.includeurl= function(){ return "/"+$scope.sampleurl; } }); </script> </body> </html>