javascript - angular directive template not loading -
my angular directive template not getting loaded app. js file directive loading fine except html. checked 'net' tab in firebug , not getting called there either. not getting errors.
here directive js:
angular.module('grid') .directive('grid', function() { return { restrict: 'a', require: 'ngmodel', scope: { ngmodel: '=' }, templateurl: 'scripts/grid/grid.html' } });
here directive html:
<div id="game"> <div class="grid-container"> <div class="grid-cell" ng-repeat="cell in ngmodel.grid track $index"></div> </div> <div class="tile-container"> <div tile ng-model="tile" ng-repeat="tile in ngmodel.tiles track $index"></div> </div>
finally here index.html meant go
<!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>
this has app being broken multiple modules new recommended structure angular
the grid
module needs dependency of twentyapp
module.
angular.module('twentyapp', ['grid'])
Comments
Post a Comment