gpt4 book ai didi

angularjs - 为什么 ng-include 没有显示任何内容?

转载 作者:行者123 更新时间:2023-12-02 11:28:41 26 4
gpt4 key购买 nike

我有一个索引文件,它使用 ng-include 引入 header 。这是我的索引文件:

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>{{page.title}}</title>
<link rel="stylesheet" href="../dist/libs/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="../dist/libs/bootstrap/dist/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="../dist/libs/animate.css/animate.min.css">
<link rel="stylesheet" href="../dist/libs/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="../dist/styles/style.min.css">
<script src="../dist/libs/jquery/dist/jquery.min.map"></script>
<script src="../dist/libs/bootstrap/dist/js/bootstrap.min.map"></script>
<script src="../dist/libs/angular/angular.min.js"></script>
<script src="../dist/libs/angular-route/angular-route.min.js"></script>

<script src="../dist/js/controllers.min.js"></script>
<script src="../dist/js/routes.min.js"></script>
<script src="../dist/js/app.min.js"></script>
</head>
<body ng-app="praxis">
<div ng-include="partials/header.html"></div>
<div ng-view></div>
</body>
</html>

我没有收到任何错误,并且我的 Controller 正在加载我的 ng-view。

这是头文件:

<div id="preloader">
<div id="status"> </div>
</div>
<div id="sb-site">
<div class="boxed">
<header id="header-full-top" class="hidden-xs header-full">
<div class="container">
<div class="header-full-title">
<h1 class="animated fadeInRight">Code<span>.<strong>Praxis</strong></span></h1>
</div>
</div>
</header>
</div>
</div>

路径是否需要基于应用程序的运行位置或索引文件所在的位置?

最佳答案

您应该在您的情况下提供一个字符串,注意文件路径周围的单引号:

<div ng-include="'partials/header.html'"></div>

来自文档:

angular expression evaluating to URL. If the source is a string constant, make sure you wrap it in single quotes, e.g. src="'myPartialTemplate.html'".

关于angularjs - 为什么 ng-include 没有显示任何内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25670167/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com