(function (app) { app.controller('myCtrl', ["$scope", "$state", "$http", "storage", "myService", "common", "config", "msg" , function ($scope, $state, $http, storage, myService, common, config, msg) { $scope.$on('$ionicView.beforeEnter', function (viewResult) { }); $scope.testuploadFile = function(files) { //单次提交图片的函数 console.log(files[0]); var formData = new FormData(); formData.append('file', files[0]); formData.append('tag', 'avatar'); $http({ method: 'POST', url: config.server + 'api/attachment/upload', transformRequest: angular.identity, data: formData, // headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8' } headers: {'Content-Type': undefined} }).then(function (result) { // alert(JSON.stringify(result)); console.log("attachment upload result:"+JSON.stringify(result)); }, function (erro) { console.log("attachment upload erro:"+JSON.stringify(erro)); }) } $scope.setAvator = function () { common.setAvator().then(function (result) { var response = JSON.parse(result.response); $timeout(function () { $scope.vm.user.avatar = response.data.md5; }); }, function (erro) { msg.erro(JSON.stringify(erro)); }); }; $scope.toprofile = function () { $state.go('app.my_profile'); } }]); app.controller('profileCtrl', ["$scope", "$state", "storage", "myService", "msg" , function ($scope, $state, storage, myService, msg) { $scope.$on('$ionicView.beforeEnter', function () { }); }]); app.controller('settingCtrl', ["$scope", "$state", "myService", "msg" , function ($scope, $state,myService, msg) { $scope.$on('$ionicView.beforeEnter', function () { }); }]); app.controller('rechargeCtrl', ["$scope", "$state", "myService", "msg" , function ($scope, $state, myService, msg) { $scope.$on('$ionicView.beforeEnter', function () { }); }]); app.controller('messageCtrl', ["$scope", "$state", "myService", "msg" , function ($scope, $state, myService, msg) { $scope.$on('$ionicView.beforeEnter', function () { }); }]); app.controller('dreamCtrl', ["$scope", "$state", "myService", "msg" , function ($scope, $state, myService, msg) { $scope.$on('$ionicView.beforeEnter', function () { }); }]); app.controller('collectCtrl', ["$scope", "$state", "myService", "msg" , function ($scope, $state, myService, msg) { $scope.$on('$ionicView.beforeEnter', function () { }); }]); app.controller('messageSysCtrl', ["$scope", "$state", "myService", "msg" , function ($scope, $state, myService, msg) { $scope.$on('$ionicView.beforeEnter', function () { }); }]); app.controller('messageReplyCtrl', ["$scope", "$state", "myService", "msg", "$ionicModal" , function ($scope, $state, myService, msg, $ionicModal) { $ionicModal.fromTemplateUrl('my-modal.html', { scope: $scope, animation: 'slide-in-up' }).then(function (modal) { $scope.modal = modal; }); $scope.openModal = function () { $scope.modal.show(); }; $scope.closeModal = function () { $scope.modal.hide(); }; $scope.$on('$ionicView.beforeEnter', function () { }); }]); })(angular.module('app.controllers'));