Commit e11b2145 authored by Randall Leeds's avatar Randall Leeds

Split the app configuration function

For readability, especially in light of the injection annotations,
split the app configuration functions in ``app.coffee``.
parent dbe42025
......@@ -23,11 +23,19 @@ resolve =
store: ['store', (store) -> store.$promise]
configure = [
'$locationProvider', '$routeProvider', '$sceDelegateProvider',
($locationProvider, $routeProvider, $sceDelegateProvider) ->
configureLocation = ['$locationProvider', ($locationProvider) ->
# Use HTML5 history
$locationProvider.html5Mode(true)
]
configureHttp = ['$httpProvider', ($httpProvider) ->
# Inject the authorization token on HTTP requests
$httpProvider.interceptors.push('jwtInterceptor')
]
configureRoutes = ['$routeProvider', ($routeProvider) ->
$routeProvider.when '/a/:id',
controller: 'AnnotationViewerController'
templateUrl: 'viewer.html'
......@@ -43,7 +51,10 @@ configure = [
resolve: resolve
$routeProvider.otherwise
redirectTo: '/viewer'
]
configureTemplates = ['$sceDelegateProvider', ($sceDelegateProvider) ->
# Configure CSP for templates
# XXX: IE workaround for the lack of document.baseURI property
baseURI = document.baseURI
......@@ -57,4 +68,12 @@ configure = [
$sceDelegateProvider.resourceUrlWhitelist ['self', basePattern]
]
configure = ['$injector', ($injector) ->
$injector.invoke(configureHttp)
$injector.invoke(configureLocation)
$injector.invoke(configureRoutes)
$injector.invoke(configureTemplates)
]
angular.module('h', imports, configure)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment