简体   繁体   中英

Angular js simple ng-include not working

I'm new in angular js. I am trying to include simple html file in my page.

This is my code:

<!DOCTYPE html>
<html ng-app="">
<head>
</head>

<body ng-controller="userController">

<div class="container">
  <div ng-include src="'about.html'"></div>
</div>

<script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script>

</body>
</html>

and about.html

<table class="table table-striped">
  <thead><tr>
    <th>Edit</th>
    <th>First Name</th>
    <th>Last Name</th>
  </tr></thead>
  <tbody><tr>
    <td>
      Edit
    </td>
    <td>ss</td>
    <td>dd</td>
  </tr></tbody>
</table> 

But it doesn't include 'about.html' page.

What's wrong with this code?(Sorry for bad english)

Thanks in advance.

Try

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

or

<ng-include src="'about.html'"></ng-include>

The included file url should be relative to the client url of the including page. You are probably using some sort of web framework that abstracts your URL format.

You should put the included files together with other static files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM