Skip to content

Instantly share code, notes, and snippets.

@jamesallardice
Last active August 29, 2015 14:07
Show Gist options
  • Save jamesallardice/3ba88dc82038a172f0b6 to your computer and use it in GitHub Desktop.
Save jamesallardice/3ba88dc82038a172f0b6 to your computer and use it in GitHub Desktop.
An example of mmRoute configuration
<a ng-href="{{ routes.get('account') }}">Your account</a>
<h2>Your friends</h2>
<ul>
<li ng-repeat="friend in friends">
<a ng-href="{{ routes.get('user', { id: friend.id }) }}">{{ friend.name }}</a>
</li>
</ul>
var app = angular.module('example', [
'mmRoute'
]);
app.config(function (mmRouteProvider) {
mmRouteProvider.setRoles([
'admin',
'user'
]);
mmRouteProvider.setRoutes({
admin: {
account: {
url: '/account',
templateUrl: '/templates/account.html',
controller: 'AccountCtrl'
}
},
user: {
url: '/users/:id',
profile: '/templates/profile.html',
controller: 'ProfileCtrl'
}
});
});
app.run(function ($rootScope, mmRoute) {
$rootScope.routes = mmRoute;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment