jquery - 将 HTML 导入 HTML
问题描述
我需要将 A.html 和 B.html 和 C.html 导入 Index.html
我尝试的方式.....它可以工作,但不知道只有一个是正常的,其他不与他们的css链接
下面是我的 index.html
它可以工作,但只有 D.html 链接它的 css。其他人的 css 布局看起来不正确。
<link rel="stylesheet" href="css/index.css">
<link rel="stylesheet" href="css/A.css">
<link rel="stylesheet" href="css/B.css">
<link rel="stylesheet" href="css/C.css">
<link rel="stylesheet" href="css/D.css">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js" defer></script>
<section ng-app="">
<div ng-include="'section/A.html'"></div>
<div ng-include="'section/B.html'"></div>
<div ng-include="'section/C.html'"></div>
<div ng-include="'section/D.html'"></div>
</section>
解决方案
这是我为帮助您解决问题而做的一个 codepen 项目: https ://codepen.io/ideaguy3d/project/editor/AdzPdm
我刚刚添加了一个角度应用程序并将 ng-app 指向它:
应用程序.js:
angular.module('myApp', []);
索引.html:
```
<section ng-app="myApp">
<div ng-include="'section/A.html'"></div>
<div ng-include="'B.html'"></div>
</section>
```
确保您的项目中也有一个名为“section”的文件夹。
推荐阅读
- kafka-consumer-api - 我们如何将 DeadLetterPublishingRecoverer 与 RetryTemplate 一起使用?
- amazon-web-services - 在 AWS SES 中提醒电子邮件用户密码过期
- swift - 获取 iCloud 共享文件夹的 URL
- .htaccess - .htaccess 带有回退的多个重定向
- jquery-mobile - 如何修复 LightSwitch HTML 应用程序变得不可滚动(在移动设备上更频繁)
- windows - 如何使用源代码在 Windows 上构建 clang-llvm?
- list - 如何使用 Java 8 将 csv 转换为 List?
- database - 如何从测量 Influxdb 中删除该字段
- excel - 我正在尝试使用 VBA 查找包含特定文本的单元格
- java - 如何使不正确的切入点表达式引发异常?