// Ionic Starter App

// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
angular.module('starter', ['ionic'])

.controller("TodoCtrl", function($scope,$ionicPopup,$ionicListDelegate,$ionicModal) {
  $scope.tasks = [];
  $scope.newTask = function(data){
    $scope.tasks.push({title:data.newItem,complete: false});
     data.newItem = ' ';
           $scope.closeModal();
    };
    $scope.edit = function(task) {
      $scope.data = { response: task.title };
      $ionicPopup.prompt({
        title: "Edit Task",
        scope: $scope
    }).then(function(res) {    // promise 
        if (res !== undefined) task.title = $scope.data.response;
        $ionicListDelegate.closeOptionButtons()
      })
    };
    $ionicModal.fromTemplateUrl('addtasks.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();
  };
  //Cleanup the modal when we're done with it!
  $scope.$on('$destroy', function() {
    $scope.modal.remove();
  });
  // Execute action on hide modal
  $scope.$on('modal.hidden', function() {
    // Execute action
  });
  // Execute action on remove modal
  $scope.$on('modal.removed', function() {
    // Execute action
  });
})

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
    if(window.cordova && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
    }
    if(window.StatusBar) {
      StatusBar.styleDefault();
    }
  });
})


@@ -438,16 +438,51 @@
 (data)%7B%0A
+    if (data.newItem!=%22 %22)%0A    %7B%0A  
     $sco
@@ -539,16 +539,17 @@
 );%0A     
+ 
 data.new
@@ -560,21 +560,16 @@
  = ' ';%0A
-     
       $s
@@ -589,16 +589,20 @@
 al();%0A  
+  %7D%0A
   %7D;%0A   

fix #4 Update js