Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

AngularJS ng-include 指令


示例

从外部文件包含 HTML

<div ng-include="'myFile.htm'"></div>
亲自试一试 »

定义和用法

ng-include 指令从外部文件包含 HTML。

包含的内容将作为指定元素的子节点包含。

ng-include 属性的值也可以是表达式,返回文件名。

默认情况下,包含的文件必须位于与文档相同的域中。


语法

<元素 ng-include="文件名" onload="表达式" autoscroll="表达式" ></元素>

ng-include 指令也可以用作元素

<ng-include src="文件名" onload="表达式" autoscroll="表达式" ></ng-include>

所有 HTML 元素都支持。


参数值

描述
filename 文件名,用单引号括起来,或返回文件名的表达式。
onload 可选。包含文件加载时要计算的表达式。
autoscroll 可选。包含的部分是否应该能够滚动到特定的视图。

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.