English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="https://cdn.staticfile.org/angular.js/1.4.6/angular.min.js</script> </head> <body ng-app=""> <div ng-include="'myFile.htm'"></div> </body> </html>Test and see ‹/›
ng-include The directive is used to include external HTML files.
The included content will be as the child node of the specified element.
ng-include
The value of the attribute can be an expression that returns a filename.
By default, the included files need to be in the same domain.
<element ng-include="filename" onload="expression" autoscroll="expression" ></element>
ng-include 指令作为元素使用:
All HTML elements support this directive.
Value | Description |
---|---|
filename | Filename, it can be used to return the filename with an expression. |
onload | Optional, the expression to be executed after the file is loaded. |
autoscroll | Optional, whether the included parts can be scrolled in the specified view. |