The is a part of my html where I am trying to include the another HTML file "content.html" but it is not working. Those addresses in the source are correct but still I am not able to make it happen.
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Basic Page Needs
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<meta charset="utf-8">
<title>Your page title here :)</title>
<meta name="description" content="">
<meta name="author" content="">
<!-- Scripts
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<script type="text/javascript" src="js\jquery-3.0.0.min.js"></script>
<script type="text/javascript" src="js/angular.min.js"></script>
</head>
<body>
<div ng-include src="'content.html'"></div>
</body>
</html>
and this is my content.html
<div class="container">
<h1>Heading!</h1>
</div>
The is a part of my html where I am trying to include the another HTML file "content.html" but it is not working. Those addresses in the source are correct but still I am not able to make it happen.
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Basic Page Needs
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<meta charset="utf-8">
<title>Your page title here :)</title>
<meta name="description" content="">
<meta name="author" content="">
<!-- Scripts
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<script type="text/javascript" src="js\jquery-3.0.0.min.js"></script>
<script type="text/javascript" src="js/angular.min.js"></script>
</head>
<body>
<div ng-include src="'content.html'"></div>
</body>
</html>
and this is my content.html
<div class="container">
<h1>Heading!</h1>
</div>
Share
edited Jul 20, 2016 at 19:45
Pankaj Parkar
136k23 gold badges240 silver badges303 bronze badges
asked Jul 20, 2016 at 19:30
Utkarsh BhimteUtkarsh Bhimte
3354 silver badges12 bronze badges
0
1 Answer
Reset to default 7You should add ng-app=""
to your page html
tag, so that angular will get kick off on the page. After that will start traversing the page & will collect all directive & it will pile them.
<html lang="en" ng-app="">
Instead of ng-include
with src
you could directly pass template value in ng-include
attribute as well.
<div ng-include="'content.html'">
Demo Plunkr
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745074889a4609775.html
评论列表(0条)