Angularjs contains
Include HTML files in HTML
In HTML, the ability to include HTML files is not currently supported.
Service side contains
Most server scripts support the Include Files feature (Ssi:servier side includes)
With SSI, you can include HTML files in HTML and send them to the client browser.
<?php require ("navigation.php") >//php
<%@ include file= ". /tkheader.jsp "%>//In JSP
The client contains
There are many ways to include files in HTML through JavaScript
Usually we use HTTP requests to fetch data from the server, and we can write to the HTML element by using innerHTML.
Angularjs contains
With Angularjs, you can use the Ng-include directive to include HTML content:
<body Ng-app=""> <div ng-include="' Runoob.htm '"></div> </body>
< Span class= "hl-quotes" > < Span class= "hl-quotes" > contains AGULARJS code
The ng-include directive can contain ANGULARJS code in addition to HTML documents
Sites.htm File Code:<Table> <Tr Ng-repeat="x in Names"> <TD>{{x.name}}</td> <TD >{{x.url}}</td> </tr> </table > < Span class= "hl-brackets" > contains sites.htm code in the file "AngularJS", it will be executed normally: Sites.htm File Code:<Div Ng-app="MyApp" Ng-controller="Sitesctrl"> <Div ng-include="' sites.htm '"></div> </Div > <script> var app = Angular.module (' myApp ', []); App.controller (' Sitesctrl ', function ($scope, $http) {$http. Get ("sites.php"). Then (function (response) {$scope. names = Response.data.records;});}); </Script> Cross-domain Containment
By default, the Ng-include directive does not allow files that contain other domain names.
If you need to include a file with another domain name, you need to set the domain name Access Whitelist:
<Body Ng-app="MyApp"> <Div ng-include= ' http://c.runoob.com/runoobtest/angular_include.php ' " ></div > < Script> var app = Angular.module (' myApp ', []) app. Config (function ($sceDelegateProvider) {$sceDelegateProvider. resourceurlwhitelist ([' http://c.runoob.com/runoobtest/** ');}); </script> </body
Angular.js contains