Skip to content

Instantly share code, notes, and snippets.

@jamesallardice
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jamesallardice/907a2093b4a0f53a1e80 to your computer and use it in GitHub Desktop.
Save jamesallardice/907a2093b4a0f53a1e80 to your computer and use it in GitHub Desktop.
An example for ngRoute configuration
<a href="/account">Your account</a>
<h2>Your friends</h2>
<ul>
<li ng-repeat="friend in friends">
<a ng-href="/users/{{ friend.id }}">{{ friend.name }}</a>
</li>
</ul>
var app = angular.module('example', [
'ngRoute'
]);
app.config(function ($routeProvider) {
$routeProvider
.when('/account', {
templateUrl: '/templates/account.html',
controller: 'AccountCtrl'
})
.when('/users/:id', {
templateUrl: '/templates/profile.html',
controller: 'ProfileCtrl'
})
.otherwise({
templateUrl: '/templates/404.html'
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment