Skip to content

Instantly share code, notes, and snippets.

@debuggerpk
Last active December 16, 2015 20:49
Show Gist options
  • Save debuggerpk/5495481 to your computer and use it in GitHub Desktop.
Save debuggerpk/5495481 to your computer and use it in GitHub Desktop.
templateUrl not invoking in angular.js
angular.module('cricketapp', []).
config(['$routeProvider', function($routeProvider){
$routeProvider.
when('/dashboard', {templateUrl: 'partials/pending-games.html', controller: GameListCtrl}).
otherwise({redirectTo: '/'});
}])
//my controller
function GameListCtrl($scope, $http) {
$http.get('api/game').success(function(data) {
$scope.games = data;
});
$scope.orderProp = 'date';
}
//my index.html
<html lang="en" ng-app="cricketapp">
<head>
...
<script src="lib/angular/angular.js"></script>
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
</head>
<body>
<div ng-view></div>
</body>
//and my pending games
<ul>
<li ng-repeat="game in games">
<p>{{ game.slug }}</p>
<p>{{ game.date | date:'fullDate' }}</p>
</li>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment