【发布时间】:2016-09-19 09:14:55
【问题描述】:
我在网站上似乎有很多这样的问题,但没有一个对我有用。
我在 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>
谁能告诉我如何解决这个问题?
【问题讨论】:
-
您能否提供您的
data-table.html相对于您的index.html的正确位置以及您在浏览器中本地使用的完整URL?
标签: javascript angularjs frontend