Reputation: 777
I've seem many questions like this in the site, but not of them worked for me.
I have this in 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'
};
});
})();
Both app.js and data-table.html are at the same level in the directory
My index.html is like this:
<html>
<head>
... some code here ...
</head>
<body ng-app="freelingApp" ng-controller="MainController">
... some code here...
<div>
<data-table></data-table>
</div>
</body>
</html>
And the contents of my data-table.html (for the time being because I'm testing) are:
<h1>Hello world!</h1>
Can someone tell me how to fix this ?
Upvotes: 0
Views: 592
Reputation: 777
Apparently the problem was with the the other framework I was using, Django, so changing the templates relative URL to an absolute URL fixed the issue
Upvotes: 0
Reputation: 360
If you use templateUrl, it should be relative to the web root url; Please refer this: Angular directive templateUrl relative to .js file
Upvotes: 1