|
|
@@ -1,20 +1,24 @@
|
|
|
-var app = angular.module('app', ['ng', 'ui.router', 'Views']);
|
|
|
-app.config(function ($httpProvider, $stateProvider, $urlRouterProvider, $locationProvider) {
|
|
|
- $httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8';
|
|
|
- $stateProvider
|
|
|
- .state('index', {
|
|
|
- url: '/index',
|
|
|
- controller: 'IndexController',
|
|
|
- templateUrl: 'app/views/index/index.tpl.html'
|
|
|
- })
|
|
|
- .state('info', {
|
|
|
- url: '/info',
|
|
|
- controller: 'InfoController',
|
|
|
- templateUrl: 'app/views/info/info.tpl.html'
|
|
|
+angular
|
|
|
+ .module('app', ['ng', 'ui.router', 'Views'])
|
|
|
+ .config(function ($httpProvider, $stateProvider, $urlRouterProvider, $locationProvider) {
|
|
|
+ $httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8';
|
|
|
+ $stateProvider
|
|
|
+ .state('index', {
|
|
|
+ url: '/',
|
|
|
+ controller: 'IndexController',
|
|
|
+ templateUrl: 'app/views/index/index.tpl.html'
|
|
|
+ })
|
|
|
+ .state('info', {
|
|
|
+ url: '/info',
|
|
|
+ controller: 'InfoController',
|
|
|
+ templateUrl: 'app/views/info/info.tpl.html'
|
|
|
+ });
|
|
|
+ $urlRouterProvider.otherwise('/'); // 未找到指定的路由地址,重定向到home页
|
|
|
+ $locationProvider.html5Mode({
|
|
|
+ enabled: true,
|
|
|
+ requireBase: false
|
|
|
});
|
|
|
- $urlRouterProvider.otherwise('index'); //未找到指定的路由地址,重定向到home页
|
|
|
- $locationProvider.html5Mode(false).hashPrefix('');
|
|
|
-});
|
|
|
-app.controller('AppController', function ($scope) {
|
|
|
- console.log('应用初始化!');
|
|
|
-});
|
|
|
+ })
|
|
|
+ .controller('AppController', function ($scope) {
|
|
|
+ console.log('应用初始化!');
|
|
|
+ });
|