var app = Angular.module (' app ', [' ui.router ', ' ngcookies ']); var server_base_url = ' http://127.0.0.1:3000/'; Initialize configuration App.run ([' $rootScope ', function ($rootScope) { $rootScope. AppName = ' graph class net '; $rootScope. desc = ' Location based address book '; $rootScope. Author = ' Ghost Rumor '; $rootScope. _email = ' wlhmyit@126.com '; }]); List of services invoked App.constant (' ServiceConfig ', { Wei_content:server_base_url + ' Wei/get ', Wei_zan:server_base_url + ' Wei/zan ', Wei_comment:server_base_url + ' wei/comment ', Wei_create:server_base_url + ' wei/create ', User_get:server_base_url + ' User/get ', User_login:server_base_url + ' User/login ', User_register:server_base_url + ' User/register ', User_common:server_base_url + ' User/getcommon ', User_ben:server_base_url + ' User/getben ', User_self:server_base_url + ' user/getself ', User_common_update:server_base_url + ' User/updatecommon ', User_ben_update:server_base_url + ' User/updateben ', User_ben_get_name:server_base_url + ' User/singleben/name ', User_common_get_nickname:server_base_url + ' User/getcommon/name ', User_ben_get_realname:server_base_url + ' User/singleben/name ', Wei_get_token_page:server_base_url + ' Wei/getbytoken ', Wei_delete:server_base_url + ' Wei/delete ', User_update_password:server_base_url + ' User/updatepassword ', Article_get:server_base_url + ' Article/get ', Article_detail:server_base_url + ' article/get/id ', Amap_url: ' Http://webapi.amap.com/maps?v=1.3&key=ad925c5003760094713775d64748d872&callback=init ' }); JSON Parse App.config ([' $httpProvider ', function ($httpProvider) { $httpProvider. defaults.headers.post[' content-type '] = ' application/x-www-form-urlencoded;charset=utf-8 '; $httpProvider. defaults.headers.put[' content-type '] = ' application/x-www-form-urlencoded;charset=utf-8 '; $httpProvider. Defaults.transformrequest = [function (data) { var obj = []; for (var key in data) { Obj.push (key + ' = ' + Data[key]); } Return Obj.join (' & '); }]; }]); Routing configuration App.config ([' $stateProvider ', ' $urlRouterProvider ', function ($stateProvider, $urlRouterProvider) { /*url Routing * * $urlRouterProvider. Otherwise ("/"); /* Status Configuration */ $stateProvider Home . State (' index ', { URL: '/', Views: { '': { Templateurl: ' views/index/index.html ', }, ' Header@index ': { Templateurl: ' views/header.html ', Controller: ' Headercontroller ' }, ' Footer@index ': { Templateurl: ' views/footer.html ', Controller: ' }, ' Weibo@index ': { Templateurl: ' views/index/weibo.html ', Controller: ' Weibocontroller ' }, ' Article@index ': { Templateurl: ' views/index/article.html ', Controller: ' Articlecontroller ' }, ' Post@index ': { Templateurl: ' views/index/post.html ', Controller: ' Postweibocontroller ' } } }) . State (' login ', { URL: '/login ', Views: { '': { Templateurl: ' views/login/login.html ', Controller: ' Logincontroller ' } } }) . State (' register ', { URL: '/register ', Views: { '': { Templateurl: ' views/register/register.html ', Controller: ' Registercontroller ' } } }) . State (' contacts ', { URL: '/contacts ', Views: { '': { Templateurl: ' views/contacts/contacts.html ', Controller: ' }, ' Header@contacts ': { Templateurl: ' views/header.html ', Controller: ' Headercontroller ' }, ' Userinfo@contacts ': { Templateurl: ' views/contacts/userinfo.html ', Controller: ' Userinfocontroller ' }, ' Map@contacts ': { Templateurl: ' views/contacts/map.html ', Controller: ' Mapcontroller ' }, ' Search@contacts ': { Templateurl: ' views/contacts/search.html ', Controller: ' Searchusercontroller ' } } }) . State (' Ucenter ', { URL: '/ucenter ', Views: { '': { Templateurl: ' views/ucenter/ucenter.html ', Controller: ' }, ' Header@ucenter ': { Templateurl: ' views/header.html ', Controller: ' Headercontroller ' }, ' Userweibo@ucenter ': { Templateurl: ' views/ucenter/weibo.html ', Controller: ' Ucweibocontroller ' }, ' Userdetailinfo@ucenter ': { Templateurl: ' views/ucenter/user.html ', Controller: ' Ucusercontroller ' }, ' Footer@ucenter ': { Templateurl: ' views/footer.html ', Controller: ' } } }) . State (' article ', { URL: '/article/:id ', Views: { '': { Templateurl: ' views/article/article.html ', Controller: ' }, ' Header@article ': { Templateurl: ' views/header.html ', Controller: ' Headercontroller ' }, ' Article_content@article ': { Templateurl: ' views/article/article_content.html ', Controller: ' Articledetailcontroller ' }, ' Footer@article ': { Templateurl: ' views/footer.html ', Controller: ' } } }) . State (' Article_index ', { URL: '/article ', Views: { '': { Templateurl: ' views/article/article.html ', Controller: ' }, ' Header@article_index ': { Templateurl: ' views/header.html ', Controller: ' Headercontroller ' }, ' Article_content@article_index ': { Templateurl: ' views/article/article_content.html ', Controller: ' Articledetailcontroller ' }, ' Footer@article_index ': { Templateurl: ' views/footer.html ', Controller: ' } } }); }]); |