angular 1.5 指令中未加载模板

Template not loading in angular 1.5 directive

我在网站上似乎遇到过很多这样的问题,但没有一个对我有用。

我在 app.js

中有这个
   (function(){
           var app = angular.module("freelingApp", ["ngRoute"]);
           app.controller("MainController",
                   ["$http", "$scope",
                   function($http, $scope){
                          ...some code here...
                  }]);
          app.directive("dataTable", function(){
                                     return{
                                             transclude:true,
                                             replace:true,
                                             restrict: 'E',
                                             templateUrl:'data-table.html'
                                     };
                                   });

})();

app.js和data-table.html都在同一目录

我的index.html是这样的:

<html>
  <head>
   ... some code here ...
  </head>

   <body ng-app="freelingApp" ng-controller="MainController">
       ... some code here...
       <div>
          <data-table></data-table>
       </div>
   </body>
</html>

而我的data-table.html的内容(暂时因为我正在测试)是:

<h1>Hello world!</h1>

谁能告诉我如何解决这个问题?

如果使用templateUrl,应该是相对于web根目录url; 请参考:Angular directive templateUrl relative to .js file

显然问题出在我使用的另一个框架 Django 上,因此将模板相对 URL 更改为绝对 URL 解决了问题