Created
June 19, 2013 20:11
-
-
Save kapv89/5817622 to your computer and use it in GitHub Desktop.
a sample router
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('sorter').config(function ($routeProvider, $locationProvider) { | |
// code fuplicated here, cos can't find a way to use custom service in config | |
var $uri = (function () { | |
var pageBase = '/admin/classification/sorter/app/', tmplBase = '/js/sorter/tmpls/', | |
apiBase = '/admin/classification/sorter/api/' | |
return { | |
page: function (uri) { return pageBase + uri; }, | |
tmpl: function (uri) { return tmplBase + uri; }, | |
api: function (uri) { return apiBase + uri; } | |
}; | |
})(); | |
/// probably can be done using a util module, but i am just flying atm | |
///////////////////////////////////////////////////////////////// | |
$routeProvider | |
.when($uri.page('artists'), { | |
resource: 'artists', | |
listingTmpl: $uri.tmpl('artists/index.html'), | |
}) | |
.when($uri.page('events'), { | |
resource: 'events', | |
listingTmpl: $uri.tmpl('events/index.html') | |
}) | |
.when($uri.page('songs'), { | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment