Advertisement
Guest User

Untitled

a guest
Oct 13th, 2015
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. // Ionic Starter App
  2.  
  3. // angular.module is a global place for creating, registering and retrieving Angular modules
  4. // 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
  5. // the 2nd parameter is an array of 'requires'
  6. angular.module('starter', ['ionic'])
  7.  
  8. .controller("Main", function($scope) {
  9.  
  10. $scope.doUpdate = function() {
  11.  
  12. //automatically deploy
  13. var deploy = new Ionic.Deploy();
  14.  
  15. // Check Ionic Deploy for new code
  16. deploy.check().then(function(hasUpdate) {
  17. console.log('Ionic Deploy: Update available: ' + hasUpdate);
  18. if(hasUpdate) {
  19. console.log('Ok, lets do an update.');
  20. deploy.update().then(function(res) {
  21. console.log('Ionic Deploy: Update Success! ', res);
  22. }, function(err) {
  23. console.log('Ionic Deploy: Update error! ', err);
  24. }, function(prog) {
  25. console.log('Ionic Deploy: Progress... ', prog);
  26. });
  27.  
  28. }
  29. }, function(err) {
  30. console.error('Ionic Deploy: Unable to check for updates', err);
  31. });
  32. };
  33.  
  34. })
  35. .run(function($ionicPlatform) {
  36. $ionicPlatform.ready(function() {
  37. // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
  38. // for form inputs)
  39. if(window.cordova && window.cordova.plugins.Keyboard) {
  40. cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
  41. }
  42. if(window.StatusBar) {
  43. StatusBar.styleDefault();
  44. }
  45.  
  46. //I will NOT be required soon!
  47. Ionic.io();
  48.  
  49. /* this whole block is broken due to a bug - will be fixed soon...
  50.  
  51. //I will NOT be required soon!
  52. Ionic.io();
  53.  
  54. //automatically deploy
  55. var deploy = new Ionic.Deploy();
  56.  
  57. // Check Ionic Deploy for new code
  58. deploy.check().then(function(hasUpdate) {
  59. console.log('Ionic Deploy: Update available: ' + hasUpdate);
  60. }, function(err) {
  61. console.error('Ionic Deploy: Unable to check for updates', err);
  62. });
  63.  
  64. */
  65.  
  66. });
  67. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement