AngularJS Includes


With AngularJS, you can include HTML from an external file.


AngularJS Includes

With AngularJS, you can include HTML content using the ng-include directive:

Output :


Include AngularJS Code

The HTML files you include with the ng-include directive can also contain AngularJS code:

<table>   <tr ng-repeat="x in names">     <td>{{ x.Name }}</td>     <td>{{ x.Country }}</td>   </tr> </table>
Output :



Include Cross Domains

By default, the ng-include directive does not allow you to include files from other domains.

To include files from another domain, you can add a whitelist of legal files and/or domains in the config function of your application:

Output :

Output :

AngularJS Strings

AngularJS strings are like JavaScript strings:

Output :