Created
July 27, 2015 22:54
-
-
Save icfantv/e09a3df4994dc52ed3b1 to your computer and use it in GitHub Desktop.
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
define(['angular-animate', | |
'angular-messages'], function() { | |
'use strict'; | |
var app = angular.module('my-module', [ | |
'ngRoute', | |
'ngAnimate', | |
'ngMessages']); | |
app.config(['$logProvider', '$routeProvider', 'DashboardConstants', InitializeRouteProvider]); | |
app.config(['$httpProvider', InitializeHttpProvider]); | |
app.run(['AlertService', 'ModalService', 'EntityCacheService', CacheInitialization]); | |
function InitializeRouteProvider($logProvider, $routeProvider, DashboardConstants) { | |
if (window.location.href.indexOf('debug=true') >= 0) { | |
$logProvider.debugEnabled(true); // don't rely on debug = true being the default | |
} | |
else { | |
$logProvider.debugEnabled(false); | |
} | |
$routeProvider.when('/', { | |
controller: 'DashboardController', | |
templateUrl: DashboardConstants.getTemplateLocation('dashboard.html') | |
}).when('/unknown', { | |
templateUrl: 'static/views/unknown.html' | |
}).otherwise({ | |
redirectTo: '/unknown' | |
}); | |
} | |
function InitializeHttpProvider($httpProvider) { | |
$httpProvider.interceptors.push('AuthorizationInterceptor', 'SessionAndClientTimeoutInterceptor'); | |
} | |
function CacheInitialization(AlertService, ModalService, EntityCacheService) { | |
ModalService.open('Populating caches...').then(function() { | |
EntityCacheService.primeCaches() | |
.then(function(result) { | |
ModalService.close(); | |
}) | |
.catch(function(error) { | |
AlertService.warn('I was unable to properly populate the caches. Application performance may be degraded.'); | |
}); | |
}); | |
} | |
return app; | |
}); |
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
require.config({ | |
baseURI: 'static/js', | |
paths: { | |
'api-check': '../third-party/angular-formly/api-check', | |
'angular': 'angular.min', | |
'angular-animate': 'angular-animate.min', | |
'angular-cookies': 'angular-cookies.min', | |
'angular-formly': '../third-party/angular-formly/formly', | |
'angular-formly-bootstrap': '../third-party/angular-formly/angular-formly-templates-bootstrap', | |
'angular-messages': 'angular-messages', | |
'angular-resource': 'angular-resource.min', | |
'angular-route': 'angular-route.min', | |
'angular-sanitize': 'angular-sanitize.min', | |
'angular-spinkit': 'angular-spinkit.min', | |
'angular-ui-tree': '../third-party/angular-ui-tree/angular-ui-tree.min' | |
}, | |
shim: { | |
'angular': { | |
exports: 'angular', | |
deps: ['lo-dash', 'jquery'] | |
}, | |
'angular-animate': { | |
deps: ['angular'] | |
}, | |
'angular-cookies': { | |
deps: ['angular'] | |
}, | |
'angular-formly': { | |
deps: ['angular', 'api-check'] | |
}, | |
'angular-formly-bootstrap': { | |
deps: ['angular-formly'] | |
}, | |
'angular-messages': { | |
deps: ['angular'] | |
}, | |
'angular-resource': { | |
deps: ['angular'] | |
}, | |
'angular-route': { | |
deps: ['angular'] | |
}, | |
'angular-sanitize': { | |
deps: ['angular'] | |
}, | |
'angular-spinkit': { | |
deps: ['angular'] | |
}, | |
'angular-ui-tree': { | |
deps: ['angular'] | |
} | |
} | |
}); | |
require(['app'], | |
function(app) { | |
angular.element(document).ready(function() { | |
angular.bootstrap(document, [app.name], { | |
strictDi: true | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment