2016-06-12 13:40:14 +08:00
|
|
|
var app = angular.module('wechat', ['ngRoute']);
|
2016-06-17 18:18:03 +08:00
|
|
|
|
|
|
|
app.constant('config', {
|
|
|
|
rootPath: '/assets/wechat/',
|
|
|
|
rootUrl: '/',
|
|
|
|
apiUrl: '/api/v1/'
|
2016-06-20 14:39:20 +08:00
|
|
|
});
|
2016-06-17 18:18:03 +08:00
|
|
|
|
2016-06-20 14:39:20 +08:00
|
|
|
|
2016-06-20 15:21:13 +08:00
|
|
|
app.run(['$rootScope', 'auth', '$location', '$routeParams', function($rootScope, auth, $location, $routeParams){
|
2016-06-20 14:39:20 +08:00
|
|
|
$rootScope.$on('$routeChangeError', function(event, next, current){
|
|
|
|
|
|
|
|
if(next && next.templateUrl){
|
|
|
|
if(!next.templateUrl.endsWith("login.html") && !next.templateUrl.endsWith("reg.html")){
|
|
|
|
$location.path("/login");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$rootScope.$on('$routeChangeStart', function(event, next, current){
|
2016-06-20 15:21:13 +08:00
|
|
|
console.log($routeParams);
|
2016-06-20 14:39:20 +08:00
|
|
|
if(next && next.templateUrl){
|
|
|
|
if(!next.templateUrl.endsWith("login.html") && !next.templateUrl.endsWith("reg.html")){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
]);
|