Javascript Angularjs ng include指令不工作
我在使用angularjs ng include指令时遇到问题。我检查了各种教程,但仍然无法解决。我想在“index.html”中显示“title.html”的内容。 “index.html”的内容:Javascript Angularjs ng include指令不工作,javascript,angularjs,Javascript,Angularjs,我在使用angularjs ng include指令时遇到问题。我检查了各种教程,但仍然无法解决。我想在“index.html”中显示“title.html”的内容。 “index.html”的内容: <html ng-app> <head> <script type="text/javascript" src="js/angular.min.js"></script> </head> <body
<html ng-app>
<head>
<script type="text/javascript" src="js/angular.min.js"></script>
</head>
<body>
<h1 ng-model="name">hello {{"name"}}</h1>
<h3 ng-include="'title.html'"></h3>
</body>
</html>
你好{{“name”}
“title.html”的内容:“sometext”
我期待这样的输出:
你好名字
一些文字
但是“sometext”不显示。请帮助您不需要单引号内的test.html。试试这个:
<h3 ng-include="title.html"></h3>
另外,ng include将无法使用file:///协议,因此请确保您使用的是web服务器