Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 角度指令模板未加载_Javascript_Html_Angularjs_Angularjs Directive - Fatal编程技术网

Javascript 角度指令模板未加载

Javascript 角度指令模板未加载,javascript,html,angularjs,angularjs-directive,Javascript,Html,Angularjs,Angularjs Directive,我的角度指令模板未加载到我的应用程序中。该指令的js文件正在加载,但html除外。我在firebug中查看了“网络”选项卡,但它也没有在那里被调用。我目前没有收到任何错误 这是我的指令: angular.module('Grid') .directive('grid', function() { return { restrict: 'A', require: 'ngModel', scope: { ngModel:

我的角度指令模板未加载到我的应用程序中。该指令的js文件正在加载,但html除外。我在firebug中查看了“网络”选项卡,但它也没有在那里被调用。我目前没有收到任何错误

这是我的指令:

angular.module('Grid')
.directive('grid', function() {
    return {
        restrict: 'A',
        require: 'ngModel',
        scope: {
            ngModel: '='
        },
        templateUrl: 'scripts/grid/grid.html'
    }
});
这是我的指令html:

<div id="game">
<div class="grid-container">
    <div class="grid-cell" ng-repeat="cell in ngModel.grid track by $index"></div>
</div>
<div class="tile-container">
    <div tile ng-model="tile" ng-repeat="tile in ngModel.tiles track by $index"></div>
</div>

最后,这里是我的index.html,它的目标是什么

    <!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>2048</title>
        <link rel="stylesheet" type="text/css" href="styles/game.css" />

        <script type="application/javascript" src="scripts/libraries/angularjs.js" ></script>
        <script type="application/javascript" src="scripts/app.js"></script>
        <script type="application/javascript" src="scripts/game/game.js"></script>
        <script type="application/javascript" src="scripts/grid/grid.js"></script>
        <script type="application/javascript" src="scripts/grid/grid_directive.js"></script>
    </head>
    <body ng-app="twentyApp">
        <!-- header -->
        <div class="container" ng-include="'views/main.html'"></div>
        <!-- script tags -->

        <div id="game-controller">
            <div grid ng-model="ctrl.game" class="row"></div>
        </div>
    </body>
</html>

2048

这个has应用程序被分解为多个模块,因为新推荐的angular结构网格
模块需要是您的
twentyApp
模块的依赖项

angular.module('twentyApp', ['grid'])

您确定正在加载网格模块吗? 试试这个:

angular.module('Grid', [])
.directive('grid', function() {