| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- /**
- * activity
- *
- */
- define([ 'angularAMD', 'ngRoute', 'ui.router', 'ui-bootstrap', 'ngLocal', 'ngTable', 'common/services', 'angular-toaster', 'ngSanitize', 'common/query/Activity'], function(angularAMD) {
- 'use strict';
- var app = angular.module('myApp', [ 'ngRoute', 'ui.router', 'ui.bootstrap', 'ng.local', 'ngTable', 'common.services', 'toaster', 'ngSanitize', 'ActivityService']);
- app.init = function() {
- angularAMD.bootstrap(app);
- };
- app.config(['$httpProvider', function ($httpProvider) {
- // http拦截
- $httpProvider.interceptors.push('httpInterceptor');
- }]);
- app.factory('httpInterceptor', ['$window', '$q', '$injector', 'BaseService', function ($window, $q, $injector, BaseService) {
- var httpInterceptor = {
- 'responseError': function (response) {
- if (response.status == 401) {// UNAUTHORIZED
- window.location.href = response.data.loginUrl || 'index';
- return $q.reject(response);
- }
- return $q.reject(response);
- }
- }
- return httpInterceptor;
- }]);
- app.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) {
- $urlRouterProvider.otherwise("/");
- $stateProvider/*.state("activity", angularAMD.route({
- url : '/',
- title : '活动中心',
- templateUrl : 'static/view/activity/activity_list.html',
- controller : 'ActivityListCtrl',
- controllerUrl : 'app/controllers/ActivityListCtrl'
- }))*/.state("detail", angularAMD.route({
- url : '/detail/:id',
- title : '活动详情',
- templateUrl : 'static/view/activity/activity_detail.html',
- controller : 'ActivityDetailCtrl',
- controllerUrl : 'app/controllers/ActivityDetailCtrl'
- }));
- }]);
- app.run(['$rootScope', 'BaseService', function($rootScope, BaseService) {
- $rootScope.rootPath = BaseService.getRootPath();
- }]);
- return app;
- });
|