(function (app) { app.controller('addCtrl', ["$scope", "$state", "storage", "myService", "msg", "$ionicTabsDelegate", "$ionicNavBarDelegate", "$ionicModal", "$ionicHistory" , function ($scope, $state, storage, myService, msg, $ionicTabsDelegate, $ionicNavBarDelegate, $ionicModal, $ionicHistory) { $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 (viewResult) { $ionicTabsDelegate.showBar(false); $ionicNavBarDelegate.showBackButton(true); }); $scope.$on('$ionicView.leave', function () { $ionicTabsDelegate.showBar(true); }); $scope.goback = function () { $ionicHistory.goBack(); }; $scope.vm={ dream:'', about:'', money:"" }; $scope.add=function () { var data={ pic:'http://img.taopic.com/uploads/allimg/130103/240435-1301030P33161.jpg', dream:$scope.vm.dream, about:$scope.vm.about, money:$scope.vm.money }; myService.add(data).then(function(result){ },function(erro){ }); } }]); })(angular.module('app.controllers'));