add.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. (function (app) {
  2. app.controller('addCtrl', ["$scope", "$state", "storage", "myService", "msg", "$ionicTabsDelegate", "$ionicNavBarDelegate", "$ionicModal", "$ionicHistory"
  3. , function ($scope, $state, storage, myService, msg, $ionicTabsDelegate, $ionicNavBarDelegate, $ionicModal, $ionicHistory) {
  4. $ionicModal.fromTemplateUrl('my-modal.html', {
  5. scope: $scope,
  6. animation: 'slide-in-up'
  7. }).then(function (modal) {
  8. $scope.modal = modal;
  9. });
  10. $scope.openModal = function () {
  11. $scope.modal.show();
  12. };
  13. $scope.closeModal = function () {
  14. $scope.modal.hide();
  15. };
  16. $scope.$on('$ionicView.beforeEnter', function (viewResult) {
  17. $ionicTabsDelegate.showBar(false);
  18. $ionicNavBarDelegate.showBackButton(true);
  19. });
  20. $scope.$on('$ionicView.leave', function () {
  21. $ionicTabsDelegate.showBar(true);
  22. });
  23. $scope.goback = function () {
  24. $ionicHistory.goBack();
  25. };
  26. $scope.vm={
  27. dream:'',
  28. about:'',
  29. money:""
  30. };
  31. $scope.add=function ()
  32. {
  33. var data={
  34. pic:'http://img.taopic.com/uploads/allimg/130103/240435-1301030P33161.jpg',
  35. dream:$scope.vm.dream,
  36. about:$scope.vm.about,
  37. money:$scope.vm.money
  38. };
  39. myService.add(data).then(function(result){
  40. },function(erro){
  41. });
  42. }
  43. }]);
  44. })(angular.module('app.controllers'));