-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
74 lines (60 loc) · 2.26 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
;(function () {
'use strict';
angular
.module('sysApp', [
'ui.bootstrap',
'ui.router',
'ngCookies',
'ngSanitize',
'angular-loading-bar',
'oc.lazyLoad',
'ncy-angular-breadcrumb',
'sysApp.layout',
'sysApp.dashboard',
'sysApp.user',
'sysApp.demo'
])
.config(appConfig)
.run(appRun);
appConfig.$inject = ['$urlRouterProvider', '$locationProvider', 'cfpLoadingBarProvider', '$breadcrumbProvider'];
appRun.$inject = ['$rootScope', '$timeout', '$log', 'cfpLoadingBar'];
function appConfig($urlRouterProvider, $locationProvider, cfpLoadingBarProvider, $breadcrumbProvider) {
$urlRouterProvider.otherwise('/');
$locationProvider.hashPrefix('!');
$locationProvider.html5Mode(false);
//cfploadingbar配置
cfpLoadingBarProvider.includeBar = true;
cfpLoadingBarProvider.includeSpinner = true;
cfpLoadingBarProvider.latencyThreshold = 500;
//$breadcrumbProvider面包屑导航
var breadcrumbTmp = '<ul class="breadcrumb">' +
'<li>' +
'<i class="icon-home home-icon"></i>' +
'<a ui-sref="dashboard">首页</a>' +
'</li><li ng-repeat="step in steps" ng-class="{active: $last}" style="padding: 0 4px;">{{step.ncyBreadcrumbLabel}}</li>' +
'</ul>';
$breadcrumbProvider.setOptions({
prefixStateName: 'index',
template: breadcrumbTmp
});
}
function appRun($rootScope, $timeout, $log, cfpLoadingBar) {
$rootScope.$on('$stateChangeStart', function (event, next) {
cfpLoadingBar.start();
//jQuery("#loadingDiv").show();
});
$rootScope.$on('$stateChangeSuccess', function (event, next) {
$log.debug("$stateChangeSuccess", next);
cfpLoadingBar.complete();
$timeout(function () {
//jQuery("#loadingDiv").hide();
}, 800);
});
$rootScope.$on('$stateChangeError', function (event, next) {
$log.debug(next);
$timeout(function () {
cfpLoadingBar.complete();
}, 500);
});
}
})();