'ng-include' directive alow to add HTML from an external file.But the file should be within the same domain.By default AngularJS does not allow cross doing HTML from an external file.
Example
This is my HTML Page.
Include Cross Domains
To include cross domain , you need to add config function of your application.
Example
025 Bootstrap Typeahead
Example
<!DOCTYPE
html>
<html>
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<body
ng-app="">
<div
ng-include="'myHtmlPage.htm'"></div>
</body>
</html>
Output
Include Cross Domains
To include cross domain , you need to add config function of your application.
Example
<!DOCTYPE
html>
<html>
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<body
ng-app="myApp">
<script>
var
app = angular.module('myApp',
[])
app.config(function
($sceDelegateProvider)
{
$sceDelegateProvider.resourceUrlWhitelist
([
'http://adrilal.blogspot.in/2016/10/dooars-tour-sultanikhola-samsing.html'
]);
});
</script>
</body>
</html>
-------------
No comments:
Post a Comment